Page 1 of 1

Searching for Text In a ComboBox

Posted: Fri Jul 22, 2011 11:53 am
by Darren
Does anybody know how I can search for a certain text string in a ComboBox. If that text string does not exist then add it to the ComboBox?

Here is the code that I am using, but it does not seem to work!

Sub UpdateComboBox()
    For Counter = 0 To ComboBox11.ItemCount
        InputString = ComboBox11.Item(Counter)

        If InputString = CheckString Then Exit Sub
    Next Counter

    ComboBox11.AddItem CheckString
End Sub

I am trying to populate a ComboBox with text from a text file. I want to search each line of text in the text file to see if it exists in the ComboBox. If it does not exist, I want to add it to the ComboBox.

Many thanks, in advance!!!!


Darren

Searching for Text In a ComboBox

Posted: Fri Jul 22, 2011 7:54 pm
by Marco
hi,
did you have tried itemcount-1
if itemcount=10 it means 0 to 9.

best regards