|
-
Aug 31st, 2001, 10:45 AM
#1
Thread Starter
Addicted Member
porobably a silly question
i have just tried adding a Progress bar to my project everythings ok but i need help on hiding it
i tried this
Private Sub pro_Click()
If pro.Caption = "Hide Progress Bar" Then GoTo 1 Else
If pro.Caption = "Show Progress Bar" Then GoTo 2
1: ProgressBar1.Visible = False
pro.Caption = "Show Progress Bar"
2: ProgressBar1.Visible = True
pro.Caption = "Hide Progress Bar"
End Sub
i think it needs some kind of end in between 1 and 2 because it does both, can someone help me out?
-
Aug 31st, 2001, 10:49 AM
#2
Fanatic Member
You need to put an Exit Sub before the second go to label. But, you should just lose goTo.
VB Code:
Private Sub pro_Click()
If pro.Caption = "Hide Progress Bar" Then
ProgressBar1.Visible = False
pro.Caption = "Show Progress Bar"
ElseIf pro.Caption = "Show Progress Bar" Then
ProgressBar1.Visible = True
pro.Caption = "Hide Progress Bar"
End If
End Sub
-
Aug 31st, 2001, 10:51 AM
#3
Frenzied Member
Do this instead.
Private Sub pro_Click()
If pro.Caption = "Hide Progress Bar" Then
ProgressBar1.Visible = False
pro.Caption = "Show Progress Bar"
Else
ProgressBar1.Visible = True
pro.Caption = "Hide Progress Bar"
End if
End Sub
Mega.
"If at first you don't succeed, then skydiving is not for you"
-
Aug 31st, 2001, 10:52 AM
#4
Frenzied Member
Cross posted again.. ARGH!!!!.. Every time.
"If at first you don't succeed, then skydiving is not for you"
-
Aug 31st, 2001, 10:56 AM
#5
Thread Starter
Addicted Member
Thanks!
-
Aug 31st, 2001, 11:27 AM
#6
New Member
Also:
Insert EXIT SUB between lin1 1. an d 2.
Private Sub pro_Click()
If pro.Caption = "Hide Progress Bar" Then GoTo 1 Else
If pro.Caption = "Show Progress Bar" Then GoTo 2
1: ProgressBar1.Visible = False
pro.Caption = "Show Progress Bar"
EXIT SUB
2: ProgressBar1.Visible = True
pro.Caption = "Hide Progress Bar"
End Sub
-
Aug 31st, 2001, 09:13 PM
#7
PowerPoster
Originally posted by alip1
Also:
Insert EXIT SUB between lin1 1. an d 2.
Nooooooooooooooooooooooooooo 
Don't use goto's at all. The only times they should be used are in error handling (On Error Goto...) and maybe if the number of nested If Then's is too great.
Regards
Stuart
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
|