Casewhere I don't understand this...
OK, its time for another noobish question, and its about Casewhere structures. Now back in VB6 I managed to get a casewhere structure working successfully, but by now I don't know how.
My Problem: I have a Combo Box on my form with a Collection of around 380 objects. I need to store specific variables under each selection in the Collection and I feel that casewhere is better than:
VB Code:
If cboObject.WhateverItemSelected = True Then
Do This
Else If cboObject.WhateverItemSelected = True Do This
Else If cboObject.WhateverItemSelected = True Do This
Else If cboObject.WhateverItemSelected = True Do This
'And this goes on for all objects
End If
So basically, casewhere would be better right? I could make a DB but I only have FileMaker and I haven't the slightest clue on how to implement a DB made in FM into a program. I'm not even at that level yet in VB.NET book! So anyway, How do I make a casewhere :blush: Thanks...
Re: Casewhere I don't understand this...
VB Code:
Select Case Me.ComboBox1.SelectedIndex
Case 1
'do your stuff
Exit Select
Case 2
'do your stuff
Exit Select
End Select
Re: Casewhere I don't understand this...
Dont forget the Case Else ;)
VB Code:
Select Case Me.ComboBox1.SelectedIndex
Case 1
'do your stuff
Case 2
'do your stuff
Case Else
'when all other options are not matched
End Select
Re: Casewhere I don't understand this...
Dude, that little animation in your sig is awesome :D
So basically, I HAVE to use Case 1, Case 2, Case 3 for all of my 380 or so entries in the collection? Why can't I use the text of the entry selected?
Re: Casewhere I don't understand this...
you can still use the text you select in your combobox
VB Code:
select case combobox1.selecteditem
'blah blah..
end case
Re: Casewhere I don't understand this...
You can also use a range...
VB Code:
Select Case Me.ComboBox1.SelectedIndex
Case 1 To 100
'do your stuff
Case 101 To 200
'do your stuff
Case Else
'when all other options are not matched
End Select
Re: Casewhere I don't understand this...
Thanks that helped :D
Man, that little fighting guy is awesome!... Why doesn't he try the door knob?