|
-
Mar 8th, 2007, 04:22 PM
#1
Thread Starter
Fanatic Member
If 2 item exist in a combobox I wanna add one more?
How can I search in a combobox if 2 different item exists? And if they exsist I wanna add one more item.
-
Mar 8th, 2007, 04:26 PM
#2
Re: If 2 item exist in a combobox I wanna add one more?
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
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.

-
Mar 8th, 2007, 04:30 PM
#3
Addicted Member
Re: If 2 item exist in a combobox I wanna add one more?
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
Kind of ugly, what it works.
- If you found my post to be helpful, please rate me.

-
Mar 8th, 2007, 05:01 PM
#4
Re: If 2 item exist in a combobox I wanna add one more?
do a search for LB_FINDSTRINGEXACT, you'll find faster API ways of doing it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|