i recently add two combo boxes in my form. the first combo box contains the categories of movies. and the other one is the list of movies sorted according to the category of movie. i just wondering how i could i add and view movies for the second combo box, when i click one of the category of movie. thank you..
view and add sub items of each item of the combo box
Collapse
X
-
Tags: None
-
Hi myanmaraladin,
You can use a nested if-else statement or a select case. Under the SelectedIndexCh anged event of your combobox1 (assuming this is your list of categories) try this:
Code:if combobox1.Text = "Action" Then combobox2.Items.Clear() combobox2.Items.Add("Action Movie 1") combobox2.Items.Add("Action Movie 2") combobox2.Items.Add("Action Movie 3") ElseIf combobox1.Text = "Sci-Fi" Then combobox2.Items.Clear() combobox2.Items.Add("Avatar") combobox2.Items.Add("Transformers") combobox2.Items.Add("X-Men") ElseIf combobox1.Text = "Comedy" combobox2.Items.Clear() combobox2.Items.Add("Ang Tanging Ina") combobox2.Items.Add("Paano Na Kaya?") combobox2.Items.Add("Agent X44") End If
Code:combobox1.Items.AddRange(New Object() {"Action Movie 1", "Action Movie 2", "Action Movie 3"})
Rey SeanComment
Comment