Link to home
Start Free TrialLog in
Avatar of 5281
5281

asked on

Populate listbox with a dataset

Hi Experts,

I want to know how to populate a listbox with a dataset.  I did the following code, but the listbox shows

System.Data.DataRowView
System.Data.DataRowView

I want to populate people's name in the listbox.  How to do that?

********************************************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     
        CallDBConn()
        Dim myCommand As New SqlDataAdapter("select * from tblUsers", objConn)

        Dim ds As DataSet = New DataSet
        myCommand.Fill(ds, "tblUsers")

        lbFrom.DataSource = ds.Tables("tblUsers").DefaultView

        DataBind()
    End Sub

ASKER CERTIFIED SOLUTION
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 5281
5281

ASKER

Thank TimCottee,

I didn't know what property I should use to display name.  Thank u very much.