[Gambas-user] Help with combobox loop please

GuruLounge - MailLists maillists at ...1367...
Tue Apr 25 08:36:32 CEST 2006


You should really check online help for these things, maybe use the
search tab for "combobox" and see what you can use (I'm assuming HELP
for most Gambas versions is similar to Gambas 1.0.15 -- what I use).

Here's some info that might help you:

To loop thru a combo box do this...
DIM I AS Integer

	FOR I = 0 TO combobox.Count - 1
		PRINT I & "--" & combobox[I].Text
	NEXT
  
But if you just want to check for an existing item do this...

	PRINT cmblocation.Find("myitem")

This will return the index number of the item if it exists (0 thru
whatever), otherwise it returns -1.

HTH,
Jeff

On Tue, 2006-04-25 at 00:41 -0500, Shannon Kuchler wrote:
> what i need to do is loop through a combobox's drop down list and im not sure 
> of the syntax
> ie...
> 
> if combobox1.text = anything in the combobox1.list then
> print "item already in list"
> else 
> do this
> end if
> 
> can anyone help please? 

-- 

     .^.
     /V\
    /( )\
    ^^-^^
Linux Advocate





More information about the User mailing list