Searching for Text In a ComboBox

In this category you can exchange your programming questions and solutions.
Post Reply
Darren
Posts: 63
Joined: Wed May 11, 2011 11:55 am

Searching for Text In a ComboBox

Post: # 735Post Darren
Fri Jul 22, 2011 11:53 am

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

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

Searching for Text In a ComboBox

Post: # 736Post Marco
Fri Jul 22, 2011 7:54 pm

hi,
did you have tried itemcount-1
if itemcount=10 it means 0 to 9.

best regards

Post Reply