grandflavour
10-21-2008, 06:05 PM
Hello everyone.
I've been searching help files and also browsing the net trying to find out how I can specify a certain index within a combobox. To add to the combo box I used combobox1.additem
What I'm trying to do is get the index so I can have a loop like the following so that no repeats are allowed in the combobox.
private sub addWord()
dim i as integer
i = 1
dim count as integer
count = 0
do while i < combobox1.itemcount
if strcomp(combobox1(i), textbox1.text, vbtextcompare) = 1 then
msgbox("Sorry word already exists")
else
count = count + 1
end if
i = i + 1
loop
if count = combobox1.itemcount then
combobox1.Additem = textbox1.text
end if
end sub
Also is there a more efficient way?
Any help greatly appreciated.
I've been searching help files and also browsing the net trying to find out how I can specify a certain index within a combobox. To add to the combo box I used combobox1.additem
What I'm trying to do is get the index so I can have a loop like the following so that no repeats are allowed in the combobox.
private sub addWord()
dim i as integer
i = 1
dim count as integer
count = 0
do while i < combobox1.itemcount
if strcomp(combobox1(i), textbox1.text, vbtextcompare) = 1 then
msgbox("Sorry word already exists")
else
count = count + 1
end if
i = i + 1
loop
if count = combobox1.itemcount then
combobox1.Additem = textbox1.text
end if
end sub
Also is there a more efficient way?
Any help greatly appreciated.