listbox cell (Solved)

I know is something simple,but i really i have stack on this 30 min now…
I have 5 empty rows with 6 column each.
Simple code to put a value in the listbox cell row 0 column 1

Dim x As Integer x = val(bA1.Caption) //Number ListBox1.Cell(0,1)=x.totext // Outofboundsexception
Where i am wrong?

you can try

ListBox1.Cell(0,1) = str(x)

The same error. Outofboundsexception

maybe you have no rows

try

ListBox1.AddRow
ListBox1.Cell(0,1) = str(x)

The rows is created before anything else from button like Listbox1.AddRow ""
This way is working,but when i click in the listbox i get the empty rows!!

Ok i found it…
Well i think i need to sleep…
i create the rows after not before,so yes you have right with the addrow :slight_smile:
Thank you @Axel Schneider