Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / February 2006

Tip: Looking for answers? Try searching our database.

Relation between two binding comboboxes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Luis Rodriguez - 31 Jan 2006 06:55 GMT
Hi everybody!

I have a Master Details Form with typed dataset. The master have two
combobox. (First ComboBox is connect with a country field and the second is
connect with the city field)

The problem is that when I move the record position, the country change and
the cities's combobox should be show the cities of the respective country.

How Can I do this with the databinding technology?

Thanks for your Help.
Luis Rodriguez
Bart Mermuys - 31 Jan 2006 14:09 GMT
Hi,

> Hi everybody!
>
> I have a Master Details Form with typed dataset. The master have two
> combobox. (First ComboBox is connect with a country field and the second
> is connect with the city field)

But are city and country in the same table or seperate tables ? Explain the
situation a little more, what and how many tables do you have. It's not
entirely clear.

Greetings

> The problem is that when I move the record position, the country change
> and the cities's combobox should be show the cities of the respective
[quoted text clipped - 4 lines]
> Thanks for your Help.
> Luis Rodriguez
Luis Rodriguez - 01 Feb 2006 13:56 GMT
Thanks for your Reply.

Let me explain you with another example.

I have the Three tables (Customes, Countries and cities)

The tables format are:

COUNTRIES:
Id
Description

CITIES:
Id
IdCountries
Description

CUSTOMERS:
Id
Name
Adreess
IdCity

The Cities have relation with Countries and the Customers have relation with
Cities.

Customers is a Master Table and have a combobox with the information of
cities and have another combobox with the information of countries.
If the user change the country, the cities's combobox must show the cities
of the respective country.
These ComboBoxes have binding with a bindingsource control.

The problem is that How can I filter the information of the cities's
combobox if I have binding it with bindingsource control?.

I like that When the user navigate across the records (Customers), the
comboboxes (countries and cities) take the respective information of the
table. Because when the user change the country, the information of city
must change to the respective country.

I don't know if you understand the problem. I can send you an example code.

Thanks for your help.
Luis Rodriguez

> Hi,
>
[quoted text clipped - 18 lines]
>> Thanks for your Help.
>> Luis Rodriguez
Bart Mermuys - 02 Feb 2006 10:34 GMT
Hi,

> Thanks for your Reply.
>
[quoted text clipped - 38 lines]
> I don't know if you understand the problem. I can send you an example
> code.

I think i understand what you are trying to do, but it doesn't seem easy to
get it right.  If i find something i'll get back to you.

Greetings

> Thanks for your help.
> Luis Rodriguez
[quoted text clipped - 21 lines]
>>> Thanks for your Help.
>>> Luis Rodriguez
Lefty - 16 Feb 2006 01:16 GMT
If you are fetching a different city list each time, you could try
something like this:

Private Sub cboCountry_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboCountry.SelectedIndexChanged

           If Not cboCountry.DataBindings("SelectedValue") Is Nothing
Then

cboCountry.DataBindings("SelectedValue").BindingManagerBase.EndCurrentEdit()
           End If

cboCity.DataBindings("SelectedValue").BindingManagerBase.SuspendBinding()

           cboCity.DataSource = GetCityDS(cboCountry.SelectedValue)

cboCity.DataBindings("SelectedValue").BindingManagerBase.ResumeBinding()
       End Sub

Alternatively, you could assign the cboCity.DataSource to a DataView of
a DataTable of all possible cities/country pairs and then change the
DataView.RowFilter in the cboCountry.SelectedIndexChanged event to
filter out all cities except those that have the same country as the
selected country.

-Paul

> Hi,
>
[quoted text clipped - 71 lines]
> >>> Thanks for your Help.
> >>> Luis Rodriguez

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.