Here's what you do. You bind the ListBox to the DataTable so that it displays the user names, e.g.
myListBox.DisplayMember = "UserName"
myListBox.ValueMember = "ID"
myListBox.DataSource = myDataTable
Now you need to bind the other controls to the same data source, e.g.
myTextBox1.DataBindings.Add("Text", myDataTable, "FirstName")
myTextBox2.DataBindings.Add("Text", myDataTable, "LastName")
This binds the Text properties of the two TextBoxes to the FirstName and LastName columns of the same table to which the ListBox is bound. That means that when you make a selection in the ListBox the contents of the TextBoxes will be updated to display the corresponding fields.
Enter your message below
Sign in or Join us (it's free).