Select Items in binded Listbox to a DataTable

A

Alex Simic

Dear all

I am very desperate with my problem and you might be probably my last
chances for this issue.

I have a listbox which is binded to a DataTable. I would like in the
program to select in this listbox some items.

I try to do this with following (of course much more profesional - but
let's keep it simple):

Me.ListBox.Items(4).Selected = True
Me.ListBox.Items(6).Selected = True
Me.ListBox.Items(8).Selected = True

This seems not to be working, since I receive the error message
===Public member "Selected" on type "DataRowView" not found.===

Please help me on how I can select and mark in the programm those
items. By the way Selectionmode is set To MultiExtended.

Alex
 
M

Matt S

Try something along these lines...

With ListBox1
.SetSelected(0, True)
.SetSelected(2, True)
End With

Hope this helps.
 
A

Alex

Perfect, it works !
THANKS A LOT
Alex


Matt S said:
Try something along these lines...

With ListBox1
.SetSelected(0, True)
.SetSelected(2, True)
End With

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top