Combobox binding problem

tsh

Member
Joined
Jan 5, 2006
Messages
12
Programming Experience
Beginner
Hey,
i have one table, eg.column 1 is product categories, column 2 is product name for each categories.
I want to create 2 combo box, combobox1 is product categories, and the combobox2 will automatically show all the product name for the selected product categories.

Can some one help me to finish the code below or any better suggestion.


Private
Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim ProductType AsString
ProductType = ComboBox1.SelectedValue.ToString
Dim drProductType As DataRow
drProductType = DataSet11.Product(ProductType)
Dim product As DataRow()
product = drProductType.?????
ComboBox2.Items.Clear()
Dim drorder As DataRow
ForEach drorder In product
ComboBox2.Items.AddRange(drorder("colum2"))
Next
EndSub

Thanks
 
i try to use child-parent relation, and the code as below:

Dim selectType AsString
selectType = ComboBox1.SelectedValue.ToString
Dim drselectType As DataRow
drselectType = DataSet11.ProductID.Rows(selectType)
Dim drProduct As DataRow()
drProduct = drselectType.GetChildRows("ProductIDproduct")
ComboBox2.Items.Clear()
Dim drtyp As DataRow
ForEach drtyp In drProduct
ComboBox2.Items.AddRange(drtyp("Field1"))
Next

but error occur at the highlight sentences.

anyone can help?
 
Back
Top