RunnTime DataBinding

  • Thread starter Thread starter VB Novice Hendri
  • Start date Start date
V

VB Novice Hendri

Guest
I have multipal Access DataBases, eatch with multipal Tabels. This is for an Virtual Recipebook in Afrikaans.

Here is what I need, I need one of the Tabels lets say Eiergeregte in the DataBases Hoofgeregte to show all the Recipe Names contained in a Listbox. When one of that Recipes is selected all of its ingredients must show in a series of TextBoxes.

I'm using Visual Studeo 2013

Belowis the code I am using so far. I have used Select Case statments since this is something that makes sence to me.

I was previosly told that Tabel and Colum Names must not contain "&" or spaces, I made the changes this leaves me with Tabel Names that does not display well, the Select Case statments solves that problem for me.

So the only DataBinding I need is being abel to show a list of Recipe names in a listbox and showing the ingrediants etc. in textboxes as mentiond above. No tabel names or so have to be shown in the listbox.

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.
TitleListBox.Items.Clear()
Select Case CategoryComboBox.Text
Case Is = "Smaaklik Tuisgemaakte Drankies"
ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Drankies.accdb"
TitleListBox.Items.Add("Koue Drankies")
TitleListBox.Items.Add("Melk Drankies")
TitleListBox.Items.Add("Warm Drankies")

Case Is = "Voorgeregte & Ander Ligte Eetes"
ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Voorgeregte.accdb"
'No need to display Tabel names since this DataBase has only one Tabel.
ActiveTabel = "VoorgeregteLigteEetes"
Call ShowRecipeNames()

Case Is = "Hoofgeregte"
ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Hoofgeregte.accdb"
TitleListBox.Items.Add("Eiergeregte")
TitleListBox.Items.Add("Heerlike Sop Resepte")
TitleListBox.Items.Add("Pasta, Bobotie, Breyani, Tamatie en Kerie")
TitleListBox.Items.Add("Viegitariese Eetes & Groente Geregte")
TitleListBox.Items.Add("Vleis Geregte")
TitleListBox.Items.Add("Pluimvee Geregte - Hoender, Eend ens.")
TitleListBox.Items.Add("Vis & ander Seekos Geregte")

Case Is = "Watertand Nageregte & Poedings"
ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Nageregte.accdb"
TitleListBox.Items.Add("Koud voorberyde Nageregte (Poedings)")
TitleListBox.Items.Add("Warm voorberyde Nageregte")

Case Is = "Kraakvars Slaai Resepte"
ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Slaaie.accdb"
'No need to display Tabel names since this DataBase has only one Tabel.
ActiveTabel = "SlaaiResepte"
Call ShowRecipeNames()

Case Is = "Souse & Marinades"
ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Souse.accdb"
'No need to display Tabel names since this DataBase has only one Tabel.
ActiveTabel = "SouseMarinades"
Call ShowRecipeNames()

Case Is = "Geurige Tuisgebak"
ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Gebak.accdb"
TitleListBox.Items.Add("Beskuit & Mosbolietjies")
TitleListBox.Items.Add("Brood & Broodrolietjies")
TitleListBox.Items.Add("Koek, Kolwyntjies & Ander Lekerneie")
TitleListBox.Items.Add("Muffens & Scones")
TitleListBox.Items.Add("Pannekoeke, Plaatkoekies & Tortillas")
TitleListBox.Items.Add("Southappies & Peeselkossies")
TitleListBox.Items.Add("Terte & Pasteie")

Case Is = "Gebottelde & Ingelegde Lekerneie"
ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Gebottelde.accdb"
TitleListBox.Items.Add("Gepeekelde Lekerneie")
TitleListBox.Items.Add("Ingelegde Vrugte & Konfyte")
TitleListBox.Items.Add("Smeere & Bladjang")

Case Is = "Wenke & Boererate vir in en om die Huis"
ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\My Documents\My Resepte\Wenke.accdb"
TitleListBox.Items.Add("Kook & Bak Wenke")
TitleListBox.Items.Add("Huishoudelike Wenke")

End Select
End Sub


Private Sub TitleListBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TitleListBox.SelectedIndexChanged

Select Case TitleListBox.SelectedItem
'Smaaklik Tuisgemaakte Drankies
Case Is = "Koue Drankies"
ActiveTabel = "KoueDrankies"
Case Is = "Melk Drankies"
ActiveTabel = "MelkDrankies"
Case Is = "Warm Drankies"
ActiveTabel = "WarmDrankies"
'Hoofgeregte
Case Is = "Eiergeregte"
ActiveTabel = "Eiergeregte"
Case Is = "Heerlike Sop Resepte"
ActiveTabel = "SopResepte"
Case Is = "Pasta, Bobotie, Breyani, Tamatie en Kerie"
ActiveTabel = "PastaBobotieBreyaniTamatieKerie"
Case Is = "Viegitariese Eetes & Groente Geregte"
ActiveTabel = "ViegitarieseEetesGroenteGeregte"
Case Is = "Vleis Geregte"
ActiveTabel = "VleisGeregte"
Case Is = "Pluimvee Geregte - Hoender, Eend ens."
ActiveTabel = "PluimveeGeregte"
Case Is = "Vis & ander Seekos Geregte"
ActiveTabel = "VisSeekosGeregte"
'Watertand Nageregte & Poedings
Case Is = "Koud voorberyde Nageregte (Poedings)"
ActiveTabel = "KoueNageregte"
Case Is = "Warm voorberyde Nageregte"
ActiveTabel = "WarmNageregte"
'Geurige Tuisgebak
Case Is = "Beskuit & Mosbolietjies"
ActiveTabel = "BeskuitMosbolietjies"
Case Is = "Brood & Broodrolietjies"
ActiveTabel = "BroodBroodrolietjies"
Case Is = "Koek, Kolwyntjies & Ander Lekerneie"
ActiveTabel = "KoekAnderLekerneie"
Case Is = "Muffens & Scones"
ActiveTabel = "MuffensScones"
Case Is = "Pannekoeke, Plaatkoekies & Tortillas"
ActiveTabel = "PannekoekePlaatkoekiesTortillas"
Case Is = "Southappies & Peeselkossies"
ActiveTabel = "SouthappiesPeeselkosies"
Case Is = "Terte & Pasteie"
ActiveTabel = "TertePasteie"
'Gebottelde & Ingelegde Lekerneie
Case Is = "Gepeekelde Lekerneie"
ActiveTabel = "GepeekeldeLekerneie"
Case Is = "Ingelegde Vrugte & Konfyte"
ActiveTabel = "IngelegdeVrugteKonfyte"
Case Is = "Smeere & Bladjang"
ActiveTabel = "SmeereBladjang"
'Wenke & Boererate vir in en om die Huis
Case Is = "Kook & Bak Wenke"
ActiveTabel = "KookBakWenke"
Case Is = "Huishoudelike Wenke"
ActiveTabel = "HuishoudelikeWenke"
End Select

Call ShowRecipeNames()

End Sub


Sub ShowRecipeNames()
'This is where the needed code will go.
End Sub

Continue reading...
 

Similar threads

V
Replies
0
Views
131
VB Novice Hendri
V
V
Replies
0
Views
120
VB Novice Hendri
V
V
Replies
0
Views
139
VB Novice Hendri
V
V
Replies
0
Views
112
VB Novice Hendri
V
Back
Top