[Gambas-user] listBox loop selected

Dan Sheffner message at ...2228...
Tue Sep 22 18:16:47 CEST 2009


Never mind I found it.

'-----------------------------
---------------------------------------------------------------------------
PUBLIC FUNCTION multipleSelections(targetLB AS ListBox) AS String
 DIM targetCount AS Integer
 DIM foundSelected AS Integer
 DIM Res AS String

 targetCount = 0
 foundSelected = 0
 DO WHILE targetCount < targetLB.Count
  IF targetLB[targetCount].selected = TRUE THEN
   Res &= targetLB[targetCount].Text & "|"
   INC foundSelected
  ENDIF
 INC targetCount
 LOOP

IF foundSelected = 0 THEN
   RETURN "Nothing found"
 ELSE
   RETURN Left(Res, Len(Res) - 1)
ENDIF

END
'--------------------------------------------------------------------------------------------------------




On Tue, Sep 22, 2009 at 11:06 AM, Dan Sheffner <message at ...2228...>wrote:

> I want all selected values from the listBox.
>
>
> On Tue, Sep 22, 2009 at 11:04 AM, Dan Sheffner <message at ...2228...>wrote:
>
>> Can someone please give me the code to loop through a listBox and put all
>> values into a string array?
>>
>> I would think this would be very straight forward but I'm having a very
>> hard time finding any documentation on this or an examples.
>>
>> Thanks in advance.
>>
>> ~Dan
>>
>
>



More information about the User mailing list