Combo Box

shrona

Member
Joined
Apr 20, 2012
Messages
5
Programming Experience
Beginner
I have created a Combo box with the 3 items.
And one more Combo Box with the 9 items.
When one item of 1st combo box selected,the 2nd combo box should show only 3 items out of 9 items.
how to do this?
I tried but not getting it.
 
The 2nd combobox should start out blank. Use a Select Case block with the first combobox. The case selector is the text of the selected item in the first combobox. If that item was selected, then clear the 2nd combobox and add the 3 items you want to it.
 
I have created a Combo box with the 3 items.
And one more Combo Box with the 9 items.
When one item of 1st combo box selected,the 2nd combo box should show only 3 items out of 9 items.
how to do this?
I tried but not getting it.

You could create a readonly property as below:

ReadOnly Property Choice(ByVal ChoiceIndex As Integer) As String()
Get​
Dim ChosenArray(2) As String​
Select Case ChoiceIndex​
Case 0​
ChosenArray = {"1","2","3"} 'Obviously you would put what you want in these arrays​
Case 1​
ChosenArray = {"4","5","6"}​
Case 2​
ChosenArray = {"7","8","9"}​
End Select​
Return ChosenArray​
End Get​
End Property

and then in the SelectedIndexChanged event:

VB.NET:
ComboBox2.Items.Clear()
ComboBox2.Items.AddRange(Choice(ComboBox1.SelectedIndex))
 
Back
Top