Hi,

I have a combobox (coProp) that I have filled with names of people in my database, using and SQL command (not linked to a dataset). I have a hidden combobox (coPropID) that holds the ids of the people in the first combobox, loaded in the same order and linked via a change event so that if the name combobox index changes, the id combobox index will change to the index of the new person's id. Next to the combobox is a button that takes me to another form where I can view and edit details of the person selected in the combobox.

On returning from editing the person's details, I want any changes to be shown in the combobox. So I am clearing and repopulating the combobox with all the people's details from the database. I then search for the originally selected person's id in the id combobox, find the index of that id and set the selectedindex of the name combobox to the same index. I was hoping that this would display the updated person's details but it still shows the original details.

Some initial debugging shows that the .Text property of the name combobox is still set to the original details. I tried setting .Text = "" before repopulating the combobox but this then just makes the combobox appear blank.

Is there a way to show the updated details? My code is below:

Dim frmPersonDetails As New frmPersonDetails
frmPersonDetails.ShowDialog() 'go to view/edit person form

'On return
Dim selID As String
Dim ind As Integer
selID = coPropID.Text
fillStaffCombo(coProp, coPropID)

If selID IsNot "" Then
comboColl = coPropID.Items()
For Each thisObject As String In comboColl
If thisObject = selID Then
ind = coPropID.Items.IndexOf(selID)
Exit For
End If
Next thisObject
coProp.SelectedIndex = ind
coProp.Text = coProp.SelectedItem
End If