Listbox error

Hi, I am using this code right out of the documentation.
I get an error.

“Parameters are not compatible with this function”
selectedRows.AddRow(row)

Var selectedRows() As DesktopListBoxRow ' Will hold the selected rows

For Each row As ListBoxRow In ListBox1.Rows
  If row.Selected Then
    selectedRows.AddRow(row)
  End If
Next

Any ideas?

Update: Hmm, it doesn’t seem to be Array.Add / Array.AddRow. I’m not sure what this example is all about.

What I would like to do is get to all of the rows selected. Is there a better way?

Had to change this

For Each row As ListBoxRow In ListBox1.Rows

to this

For Each row As DesktopListBoxRow In ListBox1.Rows
Now it works, thanks
4 Likes