How can I search in a combobox if 2 different item exists? And if they exsist I wanna add one more item.
Printable View
How can I search in a combobox if 2 different item exists? And if they exsist I wanna add one more item.
Hope this helps.. its off the head so i havent tried it.. but should work.. :)
Code:dim x as integer
for x = 0 to listbox1.listcount -1
listbox1.listindex = x
if listbox1.text = "File1" or listbox1.text = "File2" then
listbox1.add "Add new Item"
end if
next x
Kind of ugly, what it works.Code:item1found = False
item2found = False
item1 = "1"
item2 = "2"
For i = 0 To Combo1.ListCount - 1
If Combo1.List(i) = item1 Then
item1found = True
Exit For
End If
Next i
For i = 0 To Combo1.ListCount - 1
If Combo1.List(i) = item2 Then
item2found = True
Exit For
End If
Next i
If item1found = True and item2found = True Then
'Add whatever
Else
'both items were not found
End If
do a search for LB_FINDSTRINGEXACT, you'll find faster API ways of doing it