[Gambas-user] Combo Box Question

Ronan Chilvers ronan at ...384...
Wed Nov 3 22:15:00 CET 2004


Hi folks

Firstly, fantasticly well done Benoit (and everyone) for a great piece 
of software.  I'm using gambas more and more at work to write fast, smal 
but scalable database applications and its great!

Secondly a quick question on the ComboBox control.  In web forms I often 
populate combo boxes with data from a mysql table using the row id from 
the table as the option value of the dropdown list.  Eg:-

SQL : SELECT id, name FROM mynames

<select name="mynames">
	<option value="1">Name 1</option>
	<option value="2">Name 2</option>
	<option value="5">Name 3</option>
	<option value="17">Name 4</option>
</select>

As you can see the ids may or may not be sequential.  Selecting a value 
from the dropdown returns the database id of the entry.

I'd like to do the same with a combobox on a gambas form, but it seems 
the Index property has to be sequential and cannot have missing values 
(as in the above). So (assuming r is my Result object):-

while r.available
	ComboBox.Add(r["name"],r["id"])
	r.movenext
wend

doesn't work.  Am I just doing it wrong ? Or is the combobox not able to 
do things this way?  I could use one of the other controls, but a 
combobox would be ideal...

Thanks again for a great piece of software, Benoit, and good luck with 
the acting!

Ronan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20041103/aa21bd14/attachment.sig>


More information about the User mailing list