I’ve been researching this for 3 hrs to little or no avail. I’m trying to populate a ListBox with values from two TextFields when I click a button.

Here’s the code:

Dim name1 As String = nameField1.Text
Dim name2 As String = nameField2.Text

Listbox1.Cell(0, 0) = name1
Listbox1.Cell(0, 1) = name2

But this is throwing an OutOfBoundsException. Any help would be appreciated.

Did you add the row first? Row “0” doesn’t exist by default.

Listbox1.Cell(0,0) = name1
Listbox1.Cell(0,1) = name2

Or, more simply,

Listbox1.Addrow(name1, name2)

That was it. I didn’t add the row first.

Thanks, Tim