bound listbox selection

  • Thread starter Thread starter David
  • Start date Start date
D

David

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
 
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
----------------------------
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
 

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

Back
Top