[Gambas-user] Obtaining the contents of a particular Listbox index

Hans-Martin Bundeshund bundeshund at ...467...
Thu Aug 19 16:36:09 CEST 2004


Michael Sullivan <michael at ...558...> wrote:

>How do I obtain and change the contents of the
>currently selected item
>in a Listbox?

E.G. if You have a Button called 'Button1' for
finishing the selection in your Listbox, called
'ListBox1' (with Mode=Extended), you can use something
like this spagetti-code:



PUBLIC SUB Button1_Click()
  z as Integer


  IF NOT ListBox1.Current THEN
    message.Info("Please select an entry first")
  ELSE
    FOR z=0 TO ListBox1.Count-1
      IF AuswahlListBox[z].Selected THEN
        AuswahlListBox.Index = z
	Message.Info("You selected: " & ListBox1.Text)
      ENDIF
    NEXT
  ENDIF

END



If Your Listbox is running in single-mode, than you
only have to use 'TextBox1.Text' (or what propertie
you need).

HTH

HM


	

	
		
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 100MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de




More information about the User mailing list