mwalsh2000
asked on
Listbox
I have form1 which has a button which allows a user to lookup a customer name. The button, when clicked opens another form (form2) which contains a listbox and the customer names are listed in the listbox bounded from a datasource (sql table). I would like the user to be able to select an item in the listbox (by highlighting it) and clicking the select button at the bottom of the form2 and then have the item display in a text box on form1. I am trying the following code to accomplish this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelect.Click
form1.tbItemNmbr.Text = Me.lbItems.SelectedItem.To String
End Sub
The code displays "System.Data.DataRowView" in the text box not the customer name as desired. Can someone point me in the right direction on this?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelect.Click
form1.tbItemNmbr.Text = Me.lbItems.SelectedItem.To
End Sub
The code displays "System.Data.DataRowView" in the text box not the customer name as desired. Can someone point me in the right direction on this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That got it, thanks!
form1.tbItemNmbr.Text = Me.lbItems.SelectedValue