ListBox databind to DataTable

G

Greg

I've got a DataTable I'm trying to bind to a ListBox.

listBox.DataSource = dtCustomers;
listBox.DisplayMember = "customer_name";
listBox.ValueMember = "customer_id";

The returns my all the rows in the DataTable but in the
ListBox all the items are "System.Data.DataRowView".

What am I doing wrong? This works for the ComboBox.

Thanks for any help,
Greg
 
G

Greg

Opps, I had the Sorted property = true. I didn't realize
that would create this problem, but I guess it makes
sense.

Thanks,
Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top