|
-
May 4th, 2005, 01:20 AM
#1
Thread Starter
Hyperactive Member
Explicit Function return (RESOLVED)
Hello everybody
I have this very simple question. Suppose the following function :
Code:
Function ABC As Boolean
Do While <condition>
If <condition> Then
<statements>
On Error GoTo ErrorHandler
<other_statements>
ABC = True ' Correct master password
Return ' Return
End If
GoTo ShuntErrorHandler
ErrorHandler:
MsgBox "ERROR!ï", vbCritical
If Err.Number Then
Resume ShuntErrorHandler
End If
ShuntBadErrorHandler:
Loop
End Function
In this code, I just want the function to return a value and give control back to the calling procedure-function. But this does not occur! How do I tell the function to exit. Does the assignment of the function value need to be the last statement of the function?
thx, in advance
George Papadopoulos
Last edited by divined; May 4th, 2005 at 01:28 AM.
SteadFast!
-
May 4th, 2005, 01:24 AM
#2
Re: Explicit Function return
That should do it.
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
May 4th, 2005, 01:26 AM
#3
Re: Explicit Function return
Something like this:
Function ABC As Boolean
Do While <condition>
ABC = False
On Error GoTo ErrorHandler
If <condition> Then
<statements>
<other_statements>
ABC = True ' Correct master password
Exit Function ' Return
End If
Loop
exit function
ErrorHandler:
MsgBox "ERROR!ï", vbCritical
If Err.Number Then
Resume ShuntErrorHandler
End If
End Function
the forums acting up
VB Code:
Function ABC As Boolean
Do While <condition>
ABC = False
On Error GoTo ErrorHandler
If <condition> Then
<statements>
<other_statements>
ABC = True ' Correct master password
Exit Function ' Return
End If
Loop
exit function
ErrorHandler:
MsgBox "ERROR!ï", vbCritical
If Err.Number Then
Resume ShuntErrorHandler
End If
End Function
-
May 4th, 2005, 01:27 AM
#4
Thread Starter
Hyperactive Member
Re: Explicit Function return
ok. that was it. I just wasn`t aware of the statement. I was more on the grounds of the Return statement in C.
thx, for the help!
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
|