On Fri, 31 Jan 2014, PICCORO McKAY Lenz wrote: > > However, if you want to use > > strings as indices, you better forget about String[] (which only accepts > > integer indices) and use Collection. > > does gambas provide collections in same way of java does? >
No, in Gambas, a Collection is a hash table and not a set (which is what Java seems to have). You do: cCollection["key"] = value ' value is a Variant > > However, if you want to fill a ComboBox, you cannot pass a string as the > > second argument to Add()... > sorry, i forgett to make a CInteger(Val(stringvalue) ) conversion in > that lines.. > but its same, i wnt to manually set the index of the combobox.. > Yeah, should work... But you are doing it wrong in your code given. You can 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"])) 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! > > ANOTHER QUUESTION > > dos the combobox object support non sorted index i mean idex not > complety in sequence such as: > 1:pepe > 3:pablo > 4:jhon > 5:blair > > in this collection the index "2" are missing... dos combobox's suport > manually set that ? Regards, Tobi -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk ------------------------------------------------------------------------------ WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user