G
Guest
Hello,
I'm going around in circles with this problem and I hope someone can help me.
I have a listbox that is populated from a SQL Server database, with about 600 items, all strings.
I have a textbox on the same form, where I want to display which item is selected.
In the 'OnSelectedIndexChanged' event, I need code that has the textbox update to whatever value is currently selected in the listbox.
If I use the code:
TextBox1.Text = ListBox1.SelectedItem.toString
it diplays the incorrect item in the textbox.
If I use a datarow view with the following code:
Dim drv As DataRowView = lBoxCP.SelectedItem
txtCPMain.Text = drv("STR_CUTTING_PERMIT")
It works quite well, but after clicking several different items, the text box starts showing incorrect items.
SelectionMode is set to One.
Any suggestions?
Thanks,
Amber
I'm going around in circles with this problem and I hope someone can help me.
I have a listbox that is populated from a SQL Server database, with about 600 items, all strings.
I have a textbox on the same form, where I want to display which item is selected.
In the 'OnSelectedIndexChanged' event, I need code that has the textbox update to whatever value is currently selected in the listbox.
If I use the code:
TextBox1.Text = ListBox1.SelectedItem.toString
it diplays the incorrect item in the textbox.
If I use a datarow view with the following code:
Dim drv As DataRowView = lBoxCP.SelectedItem
txtCPMain.Text = drv("STR_CUTTING_PERMIT")
It works quite well, but after clicking several different items, the text box starts showing incorrect items.
SelectionMode is set to One.
Any suggestions?
Thanks,
Amber