Writing Selected ListBox Item to DB...[RESOLVED - x2]
Ok, here's an easier one (for you, not me). I'm trying to write a selected item in a listbox to my db, and I get various results with different choices.
I've tried:
listbox.SelectedItem
listbox.SelectedValue
listbox.SelectedIndex
listbox.DataSource
listbox.DisplayMember
I've tried them all with .ToString added, also.
I get db entries ranging from
"
to
System.Data.DataRowView
but no actual entry that looks anything like the customername and partnumber that's selected in the ListBox.
Re: Writing Selected ListBox Item to DB...
ListBox1.SelectedItems.Item(0))
Re: Writing Selected ListBox Item to DB...
I found it, thanks Matt! The answer is here:
http://www.vbforums.com/showpost.php...4&postcount=11
VB Code:
listbox.GetItemText(listbox.SelectedItem)
Re: Writing Selected ListBox Item to DB...
Hey Andy, that works, too (minus the second ")")...thanks. SO, which method is more reliable? Does it matter?
And thanks for changing your av...your arm must be really sore by now.
Re: Writing Selected ListBox Item to DB...
Quote:
Originally Posted by milkmood
And thanks for changing your av...your arm must be really sore by now.
hee hee...you're welcome
as far as 'reliability', i always use that code. i've never had a prob...one thing you might wanna add is a Trim() around the text to ensure you don't waste any space on your db.
:wave: