I often wonder what the Microsoft .NET CF team was smoking when it created the omission lists for the compact framework – many extremely useful calls were left out for some reason or the other (color picker, anyone?).
ComboBox objects usually contain a list of different unique strings – the little routine below implements the behaviour desktop developers find in the .FindString method:
Private Function findItem(ByVal cmb As System.Windows.Forms.ComboBox, ByVal text As String)
Dim index As Integer
For index = 0 To cmb.Items.Count - 1 'bc of weird beh
If cmb.Items.Item(index).ToString = text Then
findItem = index
Exit Function
End If
Next
findItem = -1
End Function
As usual: feel free to do whatever you feel like with this code!
Related posts:






