[Gambas-user] ComboBox options from databse
ron
ronstk at ...239...
Mon Sep 10 06:27:36 CEST 2007
On Monday 10 September 2007 00:55, Eduardo Huertas wrote:
> Thanks for the quick answer. There must be something I am missing...
>
> I have been playing with the idea you sent, but I get to the point
> where I have to add the values to the ComboBox. As far as I have read,
> the way to do it is...
> SUB Add ( Item AS String [ , Index AS Integer ]
>
> So, the method is wants a String, and will not accept a String[]
> (array) as the first parameter.
>
> What am I missing?
>
> 2007/9/9, ron <ronstk at ...239...>:
> > I did put the id,item in a array and fill the combobox from this array.
> >
> > DIM id_item as object[]
> > dim it as string[]
> >
> > for i = 0 to recordcount-1
> > it=new string[]
> > it[0]=result.field["id"]
> > it[1]=result.field['item"]
> > id_item.add(it)
> > next
> >
> > The index from the combobox is the entry in id_item array
> > This way you can even use more as 2 fields to get from the array
> >
> > index is sequential and id can be with missing numbers this way.
>
to put into the combobox do something like this
for x=0 to id_item.count-1
text=id_item[x][1]
combobox1.add(text) ' or combobox1.add(id_item[x][1])
next
the id_item array contains for each entry also a array of to values
the first is the id and the second the description from the database.
id_item[the_entry][0] = result column for id
id_item[the_entry][1] = result column for item description
Ron
More information about the User
mailing list