[Gambas-user] Listbox
Bodard Fabien
gambasfr at ...11...
Tue Jan 11 21:37:33 CET 2005
Le mardi 11 Janvier 2005 13:55, Stefan Miefert a écrit :
> Am Montag, 10. Januar 2005 23:27 schrieb Bodard Fabien:
> > > how can i insert IDs and read the selected id ?
> > >
> > > i create a listbox and enter some database entrys in this listbox
> > >
> > > ListBox1.Add (res!title)
> > >
> > > how can i get the seected values and how can i put/get the unique
> > > database id like (PRODUKTID)
> > >
> > > database structure:
> > > PRODUCTID
> > > title
> > > description
> >
> > um i think you need to make an array where you store the ids
>
> hello,
>
> ihow can i get the ids and must i make a extra array with my ids and the
> ids og the text box ?
>
Private MyArray as new string[]
Private hResult as Result
PUBLIC SUB _New()
hResult = MyConn.Exec("SELECT id, data FROM Mytable")
FOR EACH hresult
ListBox.Add(hResult!data)
MyArray.Add(hResult!id)
NEXT
END
PUBLIC SUB ListBox_Click()
Message.Info("The id is :" & MyArray[ListBox.Index])
END
2nd solution with a ListView ... More simple
Private hResult as Result
PUBLIC SUB _New()
hResult = MyConn.Exec("SELECT id, data FROM Mytable")
FOR EACH hresult
ListView.Add(hResult!id, hResult!data)
NEXT
END
PUBLIC SUB ListView_Click()
Message.Info("The id is :" & ListView.Key)
END
I hope you understand now !
Fabien BODARD
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list