By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,168 Members | 2,511 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,168 IT Pros & Developers. It's quick & easy.

Select Items in binded Listbox to a DataTable

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Try something along these lines...

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

Hope this helps.
"Alex Simic" <in********@gmx.ch> wrote in message
news:82**************************@posting.google.c om...
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

Nov 21 '05 #2

P: n/a
Perfect, it works !
THANKS A LOT
Alex
"Matt S" <ma**@toomuchspamalready.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Try something along these lines...

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

Hope this helps.
"Alex Simic" <in********@gmx.ch> wrote in message
news:82**************************@posting.google.c om...
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


Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.