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

bound listbox selection

P: n/a
Hello,
VB.NET
I have a listbox bound to a table in a dataset and I need to select
an item and copy its text value to a string variable.
Currently I have it set up like this

dim sItem as String
sItem=ListBox1.SelectedItems.ToString()

but the value stored in the variable is "System.Data.DataRowView" instead of
the selected text.
Any help would be great.
Thanks
David
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

Try something like this.

dim sItem as String
Try
Dim drv as datarowview = Ctype(listbox1.selecteditem, datarowview)
sItem = drv.item("MyColumn").tostring
Catch

end try

Ken
----------------------------
"David" <dm*******@hotmail.com> wrote in message
news:uw**************@TK2MSFTNGP09.phx.gbl...
Hello,
VB.NET
I have a listbox bound to a table in a dataset and I need to select
an item and copy its text value to a string variable.
Currently I have it set up like this

dim sItem as String
sItem=ListBox1.SelectedItems.ToString()

but the value stored in the variable is "System.Data.DataRowView" instead of
the selected text.
Any help would be great.
Thanks
David

Nov 21 '05 #2

P: n/a
Thank you very much for your post
It got me where I needed to go.
"Ken Tucker [MVP]" wrote:
Hi,

Try something like this.

dim sItem as String
Try
Dim drv as datarowview = Ctype(listbox1.selecteditem, datarowview)
sItem = drv.item("MyColumn").tostring
Catch

end try

Ken
----------------------------
"David" <dm*******@hotmail.com> wrote in message
news:uw**************@TK2MSFTNGP09.phx.gbl...
Hello,
VB.NET
I have a listbox bound to a table in a dataset and I need to select
an item and copy its text value to a string variable.
Currently I have it set up like this

dim sItem as String
sItem=ListBox1.SelectedItems.ToString()

but the value stored in the variable is "System.Data.DataRowView" instead of
the selected text.
Any help would be great.
Thanks
David

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.