SelectedValue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I set the SelectedValue of a ComboBox, it doesn't change the ComboBoxes
selectedindex to display the new item. How can i get this to work?

Thanks
 
Hi Ryan,

You may be going about it in the wrong direction. If, for example, you key
a string into a textbox and want that string to be the new setting for the
combobox, you can try something like this in the textbox's leave event:
Private Sub cbotext_Leave(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cbotext.Leave

'cbotext is the textbox; cbo is the combobox

Dim x As Integer

x = cbo.FindStringExact(cbotext.Text)

If x > -1 Then

cbo.SelectedIndex = x

End If

End Sub

HTH,

Bernie Yaeger
 
Back
Top