|
-
Feb 7th, 2000, 11:47 AM
#1
Thread Starter
New Member
I am designing an app with multiple forms. I havn't found any good documentation as to how to communicate between forms. My current need is this: I have one form with a button that loads another form. This second form has an OK & a Cancel button on it. I need to know in the parent form which button was clicked. I could set a global variable in form2 but I'm hoping there is a cleaner way of doing this.
-
Feb 7th, 2000, 12:20 PM
#2
Hyperactive Member
If that form only has an OK and a cancel button, consider using a message box instead. That will do what you want.
-
Feb 7th, 2000, 01:38 PM
#3
Addicted Member
Theres a couple of other things you can try:
Hopefully you don't wantthe user to go back to the first form when the second one is open
1) You can have a private variable in the second form that is set when you click either ok or cancel. Then you can just hide the form and test the value in the original form. ie:
within form1:
form2.show vbmodal
the_result = form2.the_private_variable
bla bla
2) Create a class that opens the second form when some method is called. The "display" method can get the result (similarly to above) and then return it as it's return value. This way jsut "wraps" it up a bit more and makes it a bit neater i suppose. Although there a most likely processing overheads doing it this way.
HTH
Mark
-
Feb 7th, 2000, 05:43 PM
#4
New Member
Similar to what funkyd77 said:
Form1 event:
Form2.Show 1
MsgBox Form1.Tag
Form2 event:
Form1.Tag = "Hi!"
Unload Me
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
|