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

I ended changing my program differently. Thanks for you help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.