I have a dataset/datatable and trying to get it to get the rows of the table to display in a ListBox.
My code so far
String disp = dt_shared.Columns["FirstName"].ToString() + " " + dt_shared.Columns["LastName"].ToString();
listBox1.DataSource = dt_shared;
listBox1.DisplayMember = disp;
listBox1.ValueMember = "Email1Address";
listBox1.DataBindings.Add("SelectedValue",dt_shared,"Email1Address");
dt_shared is the datatable and I am trying to first attempt display the FirstName, LastName and EmailAddress on one line,
Second attempt (which is not shown here), also display other attributes in the table as part of the Display member.
I thought if I can create a string disp, then I can just assign this to DisplayMember and get FirstName, LastName and EmailAddress Displayed.
However, it is only displaying the last element (EmailAddress) in the ListBox.
How can I have more than one display member?
Marika
My code so far
String disp = dt_shared.Columns["FirstName"].ToString() + " " + dt_shared.Columns["LastName"].ToString();
listBox1.DataSource = dt_shared;
listBox1.DisplayMember = disp;
listBox1.ValueMember = "Email1Address";
listBox1.DataBindings.Add("SelectedValue",dt_shared,"Email1Address");
dt_shared is the datatable and I am trying to first attempt display the FirstName, LastName and EmailAddress on one line,
Second attempt (which is not shown here), also display other attributes in the table as part of the Display member.
I thought if I can create a string disp, then I can just assign this to DisplayMember and get FirstName, LastName and EmailAddress Displayed.
However, it is only displaying the last element (EmailAddress) in the ListBox.
How can I have more than one display member?
Marika