Bubbling

B

Brian Shannon

Lets say I have the following: 'It's made up

Private Sub cmdHeader_click(.NET info)
AddLog()
Add Header()
Validate()
End sub

Private Sub AddLog()
IF me.test.text = string.empty THEN
EXIT- I WANT TO EXIT THE CODEBEHIND
ELSE
'Do Something
END IF
End Sub

When calling a sub from another sub can you exit the code behind instead of
just the sub as you would use EXIT SUB. Or do you have to exit the called
sub and be returned to the calling sub?

Thanks
 
R

Raymond Lewallen

Brian, I would do something like the following:

Private Sub cmdHeader_click(.NET info)
If Not (AddLog()) Then Exit Sub
If Not (AddHeader()) Then Exit Sub
If Not (Validate()) Then Exit Sub
End sub

Private Function AddLog() As Boolean
IF me.test.text = string.empty THEN
'EXIT- I WANT TO EXIT THE CODEBEHIND
Return False
ELSE
'Do Something
Return True
END IF
End Sub

As far as exiting the code-behind all together, I'm not this can be done,
although it might be possible. Just haven't seen anything to the effect of
doing that, as it would screw up the response object if it can't be rendered
properly do to an incomplete execution of the code-behind (I think).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,295
Latest member
EmilG1510

Latest Threads

Top