[Gambas-user] Automatic selection in a listbox

Felice Cafarelli felice.cafarelli at ...324...
Thu Dec 1 18:55:52 CET 2005


Subject: Automatic selection in a listbox
Date: 17:53, giovedì 1 dicembre 2005
From: Felice Cafarelli <felixcafarelli at ...1176...>
To: gambas-user at lists.sourceforge.net

Hi all, I had a problem with a listbox in gambas1.0.13:
I populate dinamically (values from db) a listbox, and I want to
 automatically select the first value in the list after the population. I
 tried with the property INDEX, but I got only '-1' indexes, so i cannot
 distinguish the first item in the list. What can i do?
I post here the code:

FOR i = 1 TO rNumber
    lstUsers.Add(rData!user & "(" & lstUsers.Index & ")")
    IF lstUsers.Index = 0 THEN
      lstUsers.SetFocus
      lstUsers.Current.Selected
    ENDIF
    rData.MoveNext
  NEXT

Result is this list

Bob(-1)
Simon(-1)
Teddy(-1)

So I want Bob to be automatically selected... any idea?
Cheers
Felix




More information about the User mailing list