|
-
Nov 22nd, 2000, 05:32 PM
#1
Thread Starter
Fanatic Member
hi
i am trying to dabble wth the case command here is my code
Code:
Select Case txtgrade.Text
Case "A"
lblannounce.Caption = "Perfect!"
Case "B"
lblannounce.Caption = "Great!"
Case "C"
lblannounce.Caption = "Study harder!"
Case "D"
lblannounce.Caption = "Get help!"
Case "E"
lblannounce.Caption = "Back to basics!"
Case Else
lblannounce.Caption = "Error in grade"
End Select
i have a textbox and a label all named corectley on the form
and i keep gettig the following error on the txtgrade bit
"invalid outside procedure"
does anyone know why this is happening and how can i remedy it
i only want to use the case command as i am trying to learn it
thanks for any help
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
-
Nov 22nd, 2000, 05:54 PM
#2
Addicted Member
Honestly, I'm not sure what to tell you, I created a Textbox and Label, named them the same as you have, and placed your code in the Change event for the text box.
It works properly for me...
Code:
Private Sub txtgrade_Change()
Select Case txtgrade.Text
Case "A"
lblannounce.Caption = "Perfect!"
Case "B"
lblannounce.Caption = "Great!"
Case "C"
lblannounce.Caption = "Study harder!"
Case "D"
lblannounce.Caption = "Get help!"
Case "E"
lblannounce.Caption = "Back to basics!"
Case Else
lblannounce.Caption = "Error in grade"
End Select
End Sub
Perhaps the problem is somewhere else?
Just thought I would let you know.
Michael Woolsey
Application/Web Developer
Visual Basic 6.0 SP5
Active Server Pages
Oracle 9i
- I'm going to live forever, or die trying!
-
Nov 22nd, 2000, 05:58 PM
#3
What line/word are you getting the error on?
-
Nov 22nd, 2000, 06:00 PM
#4
Thread Starter
Fanatic Member
Cheers i am soooo dumb i put it in the wrong place it wasn't in the txtgrade_change bit doh
thanks
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
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
|