turrican
Active member
Thanks to everyone who have helped me in my previous posts. Here is how i ended up making my searchable movie list. Iknow that there is a better way but this works. I would appreciate any advice on how I could have done this more efficiently. This is my first time creating a windows form like this. I am connecting to my dvd database and I have a list box of categories like action,drama etc. the user selects the genre and then a datagrid displays the title rating and other info of all of the movies in that genre. there must be a better way then having to make six data adapters and six datasets. Any advice would be appreciated. Here is my bloated code.
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
If ListBox1.SelectedItem = "Kids" Then
DataGrid1.DataSource = Dskids1.Movies
OleDbDataAdapter1.Fill(Dskids1)
ElseIf ListBox1.SelectedItem = "Comedy" Then
DataGrid1.DataSource = Dscomedy1.Movies
OleDbDataAdapter2.Fill(Dscomedy1)
ElseIf ListBox1.SelectedItem = "Drama" Then
DataGrid1.DataSource = Dsdrama1.Movies
OleDbDataAdapter3.Fill(Dsdrama1)
ElseIf ListBox1.SelectedItem = "Action" Then
DataGrid1.DataSource = Dsaction1.Movies
OleDbDataAdapter4.Fill(Dsaction1)
ElseIf ListBox1.SelectedItem = "Documentary" Then
DataGrid1.DataSource = Dsdoc1.Movies
OleDbDataAdapter5.Fill(Dsdoc1)
ElseIf ListBox1.SelectedItem = "Chick Flick" Then
DataGrid1.DataSource = Dschick1.Movies
OleDbDataAdapter6.Fill(Dschick1)
ElseIf ListBox1.SelectedItem = "Horror" Then
DataGrid1.DataSource = Dshorror1.Movies
OleDbDataAdapter2.Fill(Dshorror1)
End If
End Sub
Thanks for your time!!!
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
If ListBox1.SelectedItem = "Kids" Then
DataGrid1.DataSource = Dskids1.Movies
OleDbDataAdapter1.Fill(Dskids1)
ElseIf ListBox1.SelectedItem = "Comedy" Then
DataGrid1.DataSource = Dscomedy1.Movies
OleDbDataAdapter2.Fill(Dscomedy1)
ElseIf ListBox1.SelectedItem = "Drama" Then
DataGrid1.DataSource = Dsdrama1.Movies
OleDbDataAdapter3.Fill(Dsdrama1)
ElseIf ListBox1.SelectedItem = "Action" Then
DataGrid1.DataSource = Dsaction1.Movies
OleDbDataAdapter4.Fill(Dsaction1)
ElseIf ListBox1.SelectedItem = "Documentary" Then
DataGrid1.DataSource = Dsdoc1.Movies
OleDbDataAdapter5.Fill(Dsdoc1)
ElseIf ListBox1.SelectedItem = "Chick Flick" Then
DataGrid1.DataSource = Dschick1.Movies
OleDbDataAdapter6.Fill(Dschick1)
ElseIf ListBox1.SelectedItem = "Horror" Then
DataGrid1.DataSource = Dshorror1.Movies
OleDbDataAdapter2.Fill(Dshorror1)
End If
End Sub
Thanks for your time!!!