comboboxes relatioship detail

lukisf

Member
Joined
Apr 3, 2007
Messages
13
Programming Experience
1-3
Hi there, i'm doing my thesis and i've come up to a problem heh.

I have 2 comboboxes (cbCriteria and CbCustomer). I want to display the columns that are in a table named Customers (i already used the oledbdataadapter1 to connect the db to the project and it works), in the cbCriteria and then list the customers in the other combobox according to the criteria chosen in the combobox before.

any help please?

Thank yoju very much
luke
 
I have managed to set the relationship between both comboboxes. I typed in the collection of the cbCriteria the fields of my database (as they are in MS access) and i used this code

VB.NET:
dim dv as dataview = DsCust1.Tables("Customer").DefaultView
cbSearchCust.datasource = dv

and in the changedselectedindex of the cbCriteria i wrote this

VB.NET:
cbSearchCust.displaymember = cbCriteria.selectedItem

my problem is this. How can i set the textboxes to change according to the customer chosen in the combobox?
 
You mean like Address details?

You need to bind those textboxes to the same source as your combobox. therefore as the name in the combobox changes, it's ValueMember also changes (i.e. CustomerID) which then the textboxes change accordingly to this ValueMember.

Are you using the GUI or are you trying to do this all in code only??
 
Hi

thanks for your reply. However i have managed to find an alternative

i used

VB.NET:
me.databinding(dataset11, "Customer").Position = cbCustSearch.selectedIndex

and it worked. Thanks for your reply

Luke
 
Back
Top