V
VB Novice Hendri
Guest
I hope someone can help me.
1. I need a ListBox to be populated with Recipe Names.
2. Then after selecting one of this Recipe Names a series of TextBoxes must be filled with the recipe contense.
Here is the code I have so far with a lot of your help. I have included comments to make myself more understandable.
Private connString As String
Private Sub CategoryComboBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CategoryComboBox.SelectedIndexChanged
'The ComboBox contain an unbound list of witch the user can make a selection.
'The selection made is then matched with a corospondeg DataBase via this Select Case code block.
Select Case CategoryComboBox.Text
Case Is = "Smaaklik Tuisgemaakte Drankies"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Drankies.accdb"
Case Is = "Voorgeregte & Ander Ligte Eetes"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Voorgeregte.accdb"
Case Is = "Hoofgeregte"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Hoofgeregte.accdb"
Case Is = "Watertand Nageregte & Poedings"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Nageregte.accdb"
Case Is = "Kraakvars Slaai Resepte"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Slaaie.accdb"
Case Is = "Souse & Marinades"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Souse.accdb"
Case Is = "Geurige Tuisgebak"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Gebak.accdb"
Case Is = "Gebottelde & Ingelegde Lekerneie"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Gebottelde.accdb"
Case Is = "Wenke & Boererate vir in en om die Huis"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Wenke.accdb"
End Select
'The TitleListBox gets populated with the Colum names from the DataBase selected above.
Using myConn As OleDbConnection = New OleDbConnection(connString)
myConn.Open()
Dim dtNames As DataTable = myConn.GetSchema("Tables", New String() {Nothing, Nothing, Nothing, "TABLE"})
TitleListBox.Items.Clear()
For Each row As DataRow In dtNames.Rows
Dim tablename As String = CStr(row(2))
TitleListBox.Items.Add(tablename)
Next
End Using
End Sub
Private Sub TitleListBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TitleListBox.SelectedIndexChanged
'Now Selecting a Tabel name in this ListBox must re populate the ListBox with all Recipe Names in that Tabel.
'Selecting one of this Recipe Names must then fill a series of TextBoxes with the recipe contense.
End Sub
Continue reading...
1. I need a ListBox to be populated with Recipe Names.
2. Then after selecting one of this Recipe Names a series of TextBoxes must be filled with the recipe contense.
Here is the code I have so far with a lot of your help. I have included comments to make myself more understandable.
Private connString As String
Private Sub CategoryComboBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CategoryComboBox.SelectedIndexChanged
'The ComboBox contain an unbound list of witch the user can make a selection.
'The selection made is then matched with a corospondeg DataBase via this Select Case code block.
Select Case CategoryComboBox.Text
Case Is = "Smaaklik Tuisgemaakte Drankies"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Drankies.accdb"
Case Is = "Voorgeregte & Ander Ligte Eetes"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Voorgeregte.accdb"
Case Is = "Hoofgeregte"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Hoofgeregte.accdb"
Case Is = "Watertand Nageregte & Poedings"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Nageregte.accdb"
Case Is = "Kraakvars Slaai Resepte"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Slaaie.accdb"
Case Is = "Souse & Marinades"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Souse.accdb"
Case Is = "Geurige Tuisgebak"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Gebak.accdb"
Case Is = "Gebottelde & Ingelegde Lekerneie"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Gebottelde.accdb"
Case Is = "Wenke & Boererate vir in en om die Huis"
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Wenke.accdb"
End Select
'The TitleListBox gets populated with the Colum names from the DataBase selected above.
Using myConn As OleDbConnection = New OleDbConnection(connString)
myConn.Open()
Dim dtNames As DataTable = myConn.GetSchema("Tables", New String() {Nothing, Nothing, Nothing, "TABLE"})
TitleListBox.Items.Clear()
For Each row As DataRow In dtNames.Rows
Dim tablename As String = CStr(row(2))
TitleListBox.Items.Add(tablename)
Next
End Using
End Sub
Private Sub TitleListBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TitleListBox.SelectedIndexChanged
'Now Selecting a Tabel name in this ListBox must re populate the ListBox with all Recipe Names in that Tabel.
'Selecting one of this Recipe Names must then fill a series of TextBoxes with the recipe contense.
End Sub
Continue reading...