Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim SQL As String = "SELECT * FROM DiscInformation"
Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Owner\Desktop\db1.mdb"
Dim myConnection As OleDbConnection = New OleDbConnection(connString)
myConnection.ConnectionString = connString
Dim ds As New DataSet
Dim da As New OleDbDataAdapter(SQL, myConnection)
myConnection.ConnectionString = connString
da.Fill(ds, "DiscInformation")
ListBox1.Items.Add(ds.Tables("DiscInformation").Rows(ListBox1.SelectedIndex + 1).Item("ID"))
End Sub
End Class
Can someone helped me edit the above codes so that I can extract database from the database and display them in the Listbox... using the codes above I only can display the first entry... I think I need an Array of loop...but I dunno how to do it...help..its URGENT..
Nevermind....
But how to store a selected item from a listbox to a String?
Is it
str = [listboxname].SelectedItem
or
str = [listboxname].SelectedItem.Text
Something like that. Not totally sure.
Hope it helps.
You can search the net for more info.