Listbox populating problem

J

John

Hi

I am populating a list box using the below code;

Dim MyResult As New DataTable
Dim MySQL As String = "SELECT <field list> FROM MyTable WHERE <some
condition> ORDER BY <some order> "
Dim MyAdapter As OleDbDataAdapter = New OleDbDataAdapter(MySQL,
DBConnection())
Dim MyDV As DataView

MyResult.Clear()
MyAdapter.Fill(MyResult)
MyDV = New DataView(MyResult)

MyDV.RowFilter = ""
Me.MyListbox.DataSource = MyDV.Table

The problem is the ListBox appears filled with 'System.Data.DataRowView'
appearing on each line instead of the actual data from table. What is the
problem and how can I fix it?

Thanks

Regards
 
C

Cor Ligthert[MVP]

John,

Set the displaymember and (as you use that) the valuemember of the listbox
to their columns (just a string)

Cor
 

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

Similar Threads


Top