hi i am new to vb.net i need to know how to display a database data on listbox

Try
            Dim cn As SqlConnection
            Dim strCnn As String = "Your data base connection string"
            cn = New SqlConnection(strCnn)
            cn.Open()
            Dim comm As New SqlCommand("Your sp or Command text to get the data from DB", cn)
            '' If ur using Sp then Commandtype= CommandType.StoredProcedure if  'is  Text then comm.CommandType=CommandType.Text
            comm.CommandType = CommandType.StoredProcedure
            Dim da As New SqlDataAdapter(comm)
            Dim ds As New DataSet
            da.Fill(ds)
            ListBox1.Items.Clear()
            If ds.Tables.Count > 0 And ds.Tables(0).Rows.Count > 0 Then
                ListBox1.DataSource = ds
            End If
            ''Close your connections and commands.
        Catch ex As Exception
            ''Handle error if any
        End Try
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.