[Gambas-user] how to fill combobox with specific index from a array matrix
Tobias Boege
taboege at ...626...
Fri Jan 31 21:07:47 CET 2014
On Fri, 31 Jan 2014, PICCORO McKAY Lenz wrote:
> >> do the following: create a String[] aResult or something. Then use the
> >> hresult["whatever_id"], converted to an Integer, as index:
> >>
> >> aResult.Add(hresult["payload"], CInt(hresult["whatever_id"]))
> >>
> > umm this mees might work like the collection idea also
> dont work!!! combobox auto enumrate the index, so i'll try now with collection
>
> >> Later, return that String[] as you do.
> >>
> >> Then, when filling the ComboBox, all the elements you didn't assign anything
> >> to (the missing "whatever_id"'s will be Null):
> >>
> >> Dim aResult As String[] = GetTheResultArray()
> >> Dim iInd As Integer
> >>
> >> For iInd = 0 To aResult.Max
> >> If Not aResult[iInd] Then Continue
> >> myComboBox.Add(aResult[iInd], iInd)
> >> Next
> >>
> >> Whether this works (your question below) or how it will look like if some
> >> indices in the ComboBox are missing, I don't know. Test it!
> how can i fill the combobox but u must note the resultset object are
> not in same class
> i use a class for data and other for fill combox
>
> SO THE QUESTION ITS:
> how can i use colletions to fill the combobox?
>
You have the "whatever_id" field as an index - which is an Integer - and
still want to use Collection? OK, then:
Dim cResult As Collection = GetTheResultCollection()
Dim sRes As String
For Each sRes In cResult
myComboBox.Add(sRes, CInt(cResult.Key))
Next
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the User
mailing list