[Gambas-user] how to fill combobox with specific index from a array matrix

Tobias Boege taboege at ...626...
Fri Jan 31 17:14:47 CET 2014


On Fri, 31 Jan 2014, PICCORO McKAY Lenz wrote:
> i try to fill combobox but i cannot access array objects by index names:
> 
> ComboBoxLinDest.Add(objetivodestino["destino_descripcion"],
> objetivodestino["destino_id"])
> 
> the code to fill array matrix are:
> 
> 1) in transpor class
> 
> Public Function GetDestinos() As String[]
>     Dim RelenosCombox As New String[]
>     hresul = hconn.Find("tb_destino")
>     Do While hresul.Available
>         RelenosCombox.Add(hresul["destino_descripcion"],
> hresul["destino_id"])
>     hresul.MoveNext()
>     Loop
>     Return RelenosCombox
> End
> 
> 2) in form class
> 
> Public Sub ComboBoxLinOrig_Click()
>     Dim objetivodestino As New String[]
>     objetivodestino = operaciones.OtenerDestinos()
>     For Each objetivodestino
>         Me.ComboBoxLinDest.Add(objetivodestino["destino_descripcion"],
> objetivodestino["destino_id"])
>     Next
> End
> 
> the iden and name propierties arenot available, how can i added manualy the
> index and values to the combobox?
> 
> hurry help!!!!
> 

What you want to do is not clear at all to me. However, if you want to use
strings as indices, you better forget about String[] (which only accepts
integer indices) and use Collection.

However, if you want to fill a ComboBox, you cannot pass a string as the
second argument to Add()... I really don't understand. What is
hresult["destino_id"]? A string or an integer?

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list