|
-
Mar 8th, 2007, 10:56 AM
#1
Thread Starter
Lively Member
how to use "goto"?
how to write code using "goto"?
i get a compile error:expected:line number or label
-
Mar 8th, 2007, 10:59 AM
#2
Hyperactive Member
Re: how to use "goto"?
vb Code:
On Error GoTo ErrHandler
'your code here
Exit Sub 'This keeps it from running the error handler every time
ErrHandler: 'The name you gave it after the "GoTo" part
msgbox Err.Number & vbcrlf & Err.Description
-
Mar 8th, 2007, 10:59 AM
#3
Re: how to use "goto"?
the answer is don't - unless you're using it for an error handler, in which case:
Code:
Private Sub Command1_Click()
On Error Goto ErrHandler
' Code
Exit Sub
ErrHandler:
MsgBox "Err!"
End Sub
-
Mar 8th, 2007, 11:12 AM
#4
Re: how to use "goto"?
 Originally Posted by bushmobile
the answer is don't - unless you're using it for an error handler
Amen in spades.
However, because you asked the question I'm assuming you have some code that isn't working and you feel that a GoTo could be a solution.
Show us what you have and what you want/need to do with it.
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
|