ComboBox find item based on value

  • Thread starter Thread starter nickyw
  • Start date Start date
N

nickyw

Hi,
Can anyone help, I want to get a reference to a combobox item based on the
item's value rather than the text (basically what I am asking is, is there a
function like 'FindStringExact' for values) , does anyone know how to do
this?
Thanks,
Nicky
 
Hi nickyw

I guess you could use the SelectedValue property and inheritance like this
(not checked!):


Public Class SpecialComboBox
Inherits ComboBox

Private Function FindItemByValue(ByVal value As String) As Object
Dim oldValue As Object = Me.SelectedValue
Me.SelectedValue = value
Dim item As Object = Me.SelectedItem
Me.SelectedValue = oldValue
Return item
End Function
End Class

HTH

Nigel
 
Back
Top