473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Select Items in binded Listbox to a DataTable

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
2 2210
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alex Fimine | last post by:
Hi, I have a list box lstMy which is bound to a datatable dt. The SelectionMode in the listbox is set to MultiSimple. I want to run through the listbox and return all _values_ from the...
4
by: headware | last post by:
I have a <select> control that contains many entries. It allows the user to multi-select a group of them, click a button, and store the selected data in a database. Normally they do this starting...
1
by: Ahmet Karaca | last post by:
Hi. myds.Reset(); mycommand.SelectCommand.CommandText= "Select att1 from Ing as Ingredient, Pro as Product "+ "where Pro.ad='apple' and Pro.id=Ing.id"; mycommand.Fill(myds, "Product"); // Here...
1
by: Ed Staffin | last post by:
Is this possible? Suppose I want to display a list of stuff in a listbox and have the use select 0, 1 or more items. Filling the listbox from a datasource is no problem. How would I update a...
7
by: Sam | last post by:
Hi, I've done the method described here : http://64.78.52.104/FAQ/WinForms/FAQ_c87c.asp#q565q It works well for items added at design time. However if my source list is filled with a...
3
by: Doudou | last post by:
Hello, (I'm french, so my english isn't very good) I use a dataTable to fill a listbox (listbox databinded). This listbox has a valuemember (integer) and a displaymember (string) differents. ...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
1
by: sweetiecakes | last post by:
Hi I have a ListBox which is binded to a dataSet. When I need to refresh this dataSet, it works, but the old entries don't get removed from the listbox. Items.Clear() doesn't work when a...
17
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.