|
-
Apr 4th, 2008, 11:38 AM
#1
Thread Starter
Junior Member
Help
I am doin a school project and i am having problems with a code. It does not seem work.
Code:
Private Sub Command1_Click()
If Text1 >= 86 Then
Label2.Caption = "Nicely done!" And Image1.Visible = True
ElseIf Text1 < 86 >= 73 Then
Label2.Caption = "Good Job!" And Image2.Visible = True
ElseIf Text1 < 73 >= 65 Then
Label2.Caption = "Right on!" And Image3.Visible = True And Image5.Visible = True
ElseIf Text1 < 65 >= 60 Then
Label2.Caption = " Not bad" And Image3.Visible = True
ElseIf Text1 < 60 >= 49 Then
Label2.Caption = "You got to try harder" And Image3.Visible = True And Image6.Visible = True
ElseIf Text1 < 49 Then
Label2.Caption = "Need more studying" And Image4.Visible = True
End If
End Sub
Private Sub Command2_Click()
Label2.Caption = " "
Text1.Text = " "
End Sub
Private Sub Form_Load()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
Image6.Visible = False
End Sub
Private Sub Quit_Click()
End
End Sub
-
Apr 4th, 2008, 11:40 AM
#2
Frenzied Member
Re: Help
Welcome to VBF 
Try changing your code as follows
Code:
Label2.Caption = "Nicely done!"
Image1.Visible = True
ElseIf Text1 < 86 >= 73 Then
Label2.Caption = "Good Job!"
Image2.Visible = True
ElseIf .....
-
Apr 4th, 2008, 11:47 AM
#3
Re: Help
I would do something like
Code:
Select Case Val(Text1.Text)
Case Is > 86
Label2.Caption = "Nicely done!" And Image1.Visible = True
Case 73 To 86
Label2.Caption = "Good Job!" And Image2.Visible = True
Case 65 To 72
Label2.Caption = "Right on!" And Image3.Visible = True And Image5.Visible = True
Case 60 To 64
Label2.Caption = " Not bad" And Image3.Visible = True
Case 49 To 59
Label2.Caption = "You got to try harder" And Image3.Visible = True And Image6.Visible = True
Case Is < 49
Label2.Caption = "Need more studying" And Image4.Visible = True
End Select
-
Apr 4th, 2008, 11:50 AM
#4
Frenzied Member
Re: Help
The op would still have to move this part to the next line in each case wouldn't he?
Code:
Label2.Caption = "Nicely done!" And Image1.Visible = True
Code:
Label2.Caption = "Nicely done!"
Image1.Visible = True
-
Apr 4th, 2008, 12:00 PM
#5
Re: Help
Either that or use a string which gets passed to the label at the end.
It doesn't really matter which way though.
-
Apr 4th, 2008, 12:24 PM
#6
Re: Help
first things first
replace
If Text1 >= 86 Then
by
If Val(Text1.Text) > 86 or Val(Text1.Text) = 86 then
and so on and so forth..
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Apr 4th, 2008, 02:38 PM
#7
Thread Starter
Junior Member
Re: Help
Thanks for the help guys. i may have some more school projects i need help with in the future.
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
|