Grabbing Listbox text into textarea

  1. 9 months ago

    Arief S

    30 Jan 2018 Bandung - Indonesia

    Hi,

    I have Listbox with row data
    a,b,c,d,e,f

    I am trying to grab all the data into textarea using this code :

      dim i as integer
      for i=0 to listBox1.listcount-1
        TextArea1.Text=listBox1.cell(i,0)
      next
      

    But the result is only the last row, not all..

    any mistake in the code ?

    thanks
    regards,
    arief

       TextArea1.Text=listBox1.cell(-1,-1)

    To be verified (from memory).

  2. Emile S

    30 Jan 2018 Answer Europe (France, Strasbourg)
       TextArea1.Text=listBox1.cell(-1,-1)

    To be verified (from memory).

  3. Arief S

    30 Jan 2018 Bandung - Indonesia

    thanks..

    regards,
    arief

  4. 8 months ago

    Alberto D

    11 Feb 2018 Pre-Release Testers, Xojo Pro

    Emile, thank you, I learn something new every day.

    Arief, when you do a for...next and you use TextArea1.Text=listBox1.cell(i,0) you assign a value each time and remove the previous value, so you end with only the last value. When i=0 TextArea1.Text will be ListBox1.Cell(0,0), when I=1 the contents of TextArea1.Text will be replaced with ListBox1.Cell(1,0) and so on.

or Sign Up to reply!