-
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
-
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
-
What line/word are you getting the error on?
-
Cheers i am soooo dumb i put it in the wrong place it wasn't in the txtgrade_change bit doh
thanks