|
-
Mar 3rd, 2006, 12:11 PM
#1
Thread Starter
Junior Member
[RESOLVED] Cancel Form
Is there a way to detect if someone pressed cancel on form?
I have a procedure that call two form after each other. The first if the use click ok updates some registry entries. The second on then show the display with the new enties. If The user presses cancel I do not want the second for to show.
Right now I am just doing
frmSetUp.Show vbModal
frmDisplay.Show vbModal
-
Mar 3rd, 2006, 12:17 PM
#2
Re: Cancel Form
Welcome to the forums. 
What do you mean by "cancel"? Hitting the close, X, button in the upper right hand corner?
-
Mar 3rd, 2006, 12:17 PM
#3
Addicted Member
Re: Cancel Form
 Originally Posted by Ron22
Is there a way to detect if someone pressed cancel on form?
I have a procedure that call two form after each other. The first if the use click ok updates some registry entries. The second on then show the display with the new enties. If The user presses cancel I do not want the second for to show.
Right now I am just doing
frmSetUp.Show vbModal
frmDisplay.Show vbModal
Have the cancel button place like "CANCELED" or something either in a variable that can be read or in it's form's tag.
Like Form1.tag="CANCELED"
then just check the tag before opening the second form.
Mike
-
Mar 3rd, 2006, 12:27 PM
#4
Re: Cancel Form
Add a public boolean to your main Form, and set it to False, so you'll set it to true when the user clicks OK in the second Form.
I'll call your main form Form1
VB Code:
Public mContinue As Boolean 'This one can be accessed from the other Forms
Private Sub InitProcess()
mContinue = False
frmSetUp.Show vbModal
If mContinue Then
frmDisplay.Show vbModal
End If
End Sub
Then in frmSetUp, in the code for the Ok button event, add.
VB Code:
'...Code..
Form1.mContinue = True
Unload Me
If you don't want to add a public variable, use property get and propery set, with a private variable.
-
Mar 3rd, 2006, 12:31 PM
#5
Thread Starter
Junior Member
Re: Cancel Form
First Hack what I ment by canceld was press the button labled "Cancel" Cancel set to true. So either the operator pressed esc or the x button or pressed cancel.
jcis & MikeJoel Thanks for the quick answer
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
|