|
-
Jul 6th, 2002, 07:29 PM
#1
Thread Starter
Fanatic Member
Help with Select Case Statement
Ok, I have used this one in a while. I usually just use IF...THEN statements. How should I set this up?
VB Code:
Select Case
Case 1 ' Option button 1 is selected on my form
'do stuff here
Case 2 ' Option button 2 is selected
etc.
Enc Select
I got an erro after I typed "Select Case" and hit enter. Something like expected expression. what am I leaving out?
-
Jul 6th, 2002, 07:30 PM
#2
Thread Starter
Fanatic Member
Man I screwed up that post...
I can't type today!!!!!!!!!!
-
Jul 6th, 2002, 07:31 PM
#3
-= B u g S l a y e r =-
-
Jul 6th, 2002, 07:32 PM
#4
Frenzied Member
VB Code:
Select Case [i]Expression[/i]
Case 1
'Do Something
Case ...
'...
Case Else
'...
End Select
MicroBasic
Dragon Shadow Trainer
There is no good or evil in the world...only programmers and fools .
-
Jul 6th, 2002, 07:35 PM
#5
Re: Help with Select Case Statement
Originally posted by hipopony66
Ok, I have used this one in a while. I usually just use IF...THEN statements. How should I set this up?
VB Code:
Select Case
Case 1 ' Option button 1 is selected on my form
'do stuff here
Case 2 ' Option button 2 is selected
etc.
Enc Select
I got an erro after I typed "Select Case" and hit enter. Something like expected expression. what am I leaving out?
hopefuly you didnt spell it "Enc Select" in your code
-
Jul 6th, 2002, 07:51 PM
#6
Thread Starter
Fanatic Member
No, I didn't
I spelled END SELECT. Do I not need select case for this purpose? I need to do something different depending on which one of 6 option buttons are selected.
-
Jul 6th, 2002, 07:59 PM
#7
-
Jul 6th, 2002, 08:28 PM
#8
I disagree with Microbasic because he is overlooking the very useful but under-used Select Case True.
In this case it would be used something like this
VB Code:
Select Case True
Case Opt1.Value = True
Case Opt2.Value = True
etc.
End Select
-
Jul 6th, 2002, 08:36 PM
#9
Thread Starter
Fanatic Member
Well, how bout this to ponder on!
Thanks Martin, I think that's what I need. How bout this though? I've heard good a bad things about this. What if I created a control array with 6 option buttons called optWhatToDo, and then use a Select case statement with the index values of the control? Can anyone say anything good or bad about control arrays?? The VB class I took last semester used them a lot, but I never used them before the class and rarely do now.
-
Jul 6th, 2002, 08:41 PM
#10
The picture isn't missing
control arrays save memory if you are using labels to have a static usage(they won't change). they can sometimes be very useful and can save you changing many subs of the same controls with almost the same code.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|