Anthony Matovu
asked on
populating a combobox
I have 5 comboboxes where by the items in the second combobox depend on the section in the first one, the third depends on the second, and so on.
Challenge i have is when i make the first selection all the file get populated with the first element
below is the example of the code i use. this is a windows application for vb.net
Try
dadp = New OleDb.OleDbDataAdapter("SE LECT * FROM [villageUnit] WHERE ((([country])= '" & cmbcountry.SelectedValue & "'));", db)
dT = New DataTable : dadp.Fill(dT) : dadp.Dispose()
vu.DataSource = dT
vu.DisplayMember = "villageName" : vu.ValueMember = "vid"
vu.BindingContext = New BindingContext : vu.SelectedIndex = -1
Me.hhcode.Text = ""
Catch inv As InvalidCastException
Catch ex As Exception
Anthony
Challenge i have is when i make the first selection all the file get populated with the first element
below is the example of the code i use. this is a windows application for vb.net
Try
dadp = New OleDb.OleDbDataAdapter("SE
dT = New DataTable : dadp.Fill(dT) : dadp.Dispose()
vu.DataSource = dT
vu.DisplayMember = "villageName" : vu.ValueMember = "vid"
vu.BindingContext = New BindingContext : vu.SelectedIndex = -1
Me.hhcode.Text = ""
Catch inv As InvalidCastException
Catch ex As Exception
Anthony
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sorry its is
Challenge i have is when i make the first selection all the five comboboxes get populated with the first element/item
Challenge i have is when i make the first selection all the five comboboxes get populated with the first element/item
When you make selection in first combobox, all other comboboxes get populated? What is vu? Do you have a single selecteditemchanged handler for all comboboxes?
ASKER
vu is the name of the second combobox that gets populated after an item from the first combo has been selected. all other comboboxes are populated like that.
I think i dont understand what single selecteditemchanged handler means, but these are comboboxes
Thanks
Anthony
I think i dont understand what single selecteditemchanged handler means, but these are comboboxes
Thanks
Anthony
have you read my article? it is dedicated to relational combo
Can you show the full code where the above code is?
Not sure what you mean by that.