COOMET
asked on
ComboBox Index and Select Case question
I have four combobox indexed as Combo1(index). How can we use 'Select Case' for the Click event of Combo1(Index) ? I tried it as follows but each combobox is mixing to a wrong statement. The statement of each 'Case' use the 'For i=0 to Combo1(index).ListIndex'. Any help please ?
Private Sub Combo1_Click(Index As Integer)
Dim i,j As Integer
Select Case Combo1(j)
Case 0
'Statement 0
For i=0 to Combo1(index).ListIndex
'Some tasks
Next i
Case 1
'Statement 1
Case 2
'Statement 2
Case 3
'Statement 3
End Select
End Sub
Private Sub Combo1_Click(Index As Integer)
Dim i,j As Integer
Select Case Combo1(j)
Case 0
'Statement 0
For i=0 to Combo1(index).ListIndex
'Some tasks
Next i
Case 1
'Statement 1
Case 2
'Statement 2
Case 3
'Statement 3
End Select
End Sub
ASKER
angelIII:
Thank you. The code is still mixing the items of the list with the combo index. Here is the idea. Once I select a combo, say combo1(o), I click in the list of that combo. If the ListIndex value of that combo is 10, 10 picture squares will be visible. If the list index is 5, only five picture squares will be visible.... and so on. Since I have four categories of pictureboxes, I linked each picturebox index with the combobox (index) event. Thus
Case 0 'when I click at Combo1(0)
For i=0 to Combo1(Index).ListIndex
PictureBox1(i).Visible=Tru e
Next i
===> If the listindex value while clicking at Combo1(0) is 5, then I have to get five pic boxes visible as follows:
For i=0 to 5
PictureBox1(i).visible=Tru e
Next
Thank you. The code is still mixing the items of the list with the combo index. Here is the idea. Once I select a combo, say combo1(o), I click in the list of that combo. If the ListIndex value of that combo is 10, 10 picture squares will be visible. If the list index is 5, only five picture squares will be visible.... and so on. Since I have four categories of pictureboxes, I linked each picturebox index with the combobox (index) event. Thus
Case 0 'when I click at Combo1(0)
For i=0 to Combo1(Index).ListIndex
PictureBox1(i).Visible=Tru
Next i
===> If the listindex value while clicking at Combo1(0) is 5, then I have to get five pic boxes visible as follows:
For i=0 to 5
PictureBox1(i).visible=Tru
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Dim i,j As Integer
Select Case Combo1(index)
Case 0
'Statement 0
For i=0 to Combo1(index).ListIndex
'Some tasks
Next i
Case 1
'Statement 1
Case 2
'Statement 2
Case 3
'Statement 3
End Select
End Sub