For some reason, before the selectedindexchanged sub routine finishes, combobox Description is still pointing on the last selectedindex changed and the combobox Image is on the actual current selected index changed. Once it exits the routine both combobox are in the current value.

I cant see why this is happening, causing a lot of trouble.

Private Sub Connection()
    con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Test\Database1.accdb"
    con.Open()
    Dim ds As New DataSet
    Dim dt As New DataTable
    ds.Tables.Add(dt)
    Dim da As New OleDb.OleDbDataAdapter
    da = New OleDbDataAdapter(databasetable, con)
    da.Fill(dt)
    dt.DefaultView.Sort = "Item ASC"
    cmbItem.DataSource = dt
    cmbItem.DisplayMember = "Item"
    cmbImage.DataSource = dt
    cmbImage.DisplayMember = "Image"
    cmbDescription.DataSource = dt
    cmbDescription.DisplayMember = "Description"
    cmbFeatures.DataSource = dt
    cmbFeatures.DisplayMember = "Performance Feature"
    cmbOptions.DataSource = dt
    cmbOptions.DisplayMember = "Options"
    con.Close()
End Sub

Private Sub cmbItem_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles                    cmbImage.SelectedIndexChanged
    dirDescription = cmbDescription.Text
    pcbCatalog.ImageLocation = cmbImage.Text
End Sub

Recommended Answers

All 2 Replies

to add more, what I would like is to have one "Mother" combobox, and the rest of the combobox to change their selectedindex to the one that the Mother combobox has.

What do u actually want to do in ur coding???

set the combo box value for 1 combox and then on the selection change event get the remaining values....

if I am wrong then can you be little more clear....

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.