I have a database with a table called BREAKFASTMILK
Inside the table I have Two Columns named MENU and FOOD ITEM

when using this code if I change the index of one of comboboxes it will change the index of the other.


I want to keep both independent but get their data from the same table.

With frm.cmbSUBRmeMilk
            .DataSource = sundaydata.get_menuBRMILK.Tables("BREAKFASTMILK")
            .DisplayMember = "MENU"
            .ValueMember = "MENU"
            .SelectedIndex = 0
        End With

 With frm.cmbSUBRfiMilk
            .DataSource = sundaydata.get_menuBRMILK.Tables("BREAKFASTMILK")
            .DisplayMember = "FOOD ITEM"
            .ValueMember = "FOOD ITEM"
            .SelectedIndex = 0
        End With

Thanks for your help

try this if it works.. put it in an SelectedIndexChanged Event

Private Sub cmbSUBRmeMilk_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbSUBRmeMilk.SelectedIndexChanged


        cmbSUBRfiMilk.SelectedIndex = cmbSUBRmeMilk.SelectedIndex
End Sub

try this if it works.. put it in an SelectedIndexChanged Event

Private Sub cmbSUBRmeMilk_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbSUBRmeMilk.SelectedIndexChanged


        cmbSUBRfiMilk.SelectedIndex = cmbSUBRmeMilk.SelectedIndex
End Sub

That what i'm trying to prevent. for some reason it does that

This article has been dead for over six months. Start a new discussion instead.