|
-
October 17th, 2004, 01:58 AM
#1
How do you reload a form?
Hey I got a real noob question for yahs , I have just never had to do it. I need to know how to reload a form so that all its values are set back to the time it was originally loaded.
Thanks heaps in advance.
-
October 17th, 2004, 02:05 AM
#2
Re: How do you reload a form?
Hi.
Try to do the following from another form or module:
Code:
Unload frmMyForm
frmMyForm.Show
It should work.
Regards,
Michael
-
October 17th, 2004, 02:17 AM
#3
Re: How do you reload a form?
Yeah I tried that and instead of the .show I used .visible = true, but both dont actually do all the commands within the form load.
I dont get why that doesn't work because it is logical that it would close down the form and "HAVE TO" reload it and therefore re do the code in the Form_load. But it doesn' seem to, please I really need to know how to overcome this problem. Thanks for your help though Micheal
-
October 17th, 2004, 02:38 AM
#4
Re: How do you reload a form?
Following code does NOT call Form_Initialize, but calls Form_QueryUnload, Form_Unload, Form_Load (generated by Unload & Load) and all other events generated by Show() method:
Code:
Sub reloadForm(frm As Form)
Unload frm
Load frm
frm.Show
End Sub
Best regards,
-
October 17th, 2004, 02:51 AM
#5
Re: How do you reload a form?
Thanks heaps hey, the code
Unload frm
Load frm
frm.Show
worked. But I just dont understand what the difference is between
Unload frm
Load frm
frm.Show
and just
Unload frm
Load frm
-
October 17th, 2004, 03:22 AM
#6
Re: How do you reload a form?
If you don't call Unload, then Load will be ignored. So, you must call Unload before, and that also means closing the form. Load call doesn't bring back the window for you, thus you have to call Show, to make the form visible again.
If you'd like to understand more about the events generated, create a test project and put message boxes or log in a file all the events of a form object. Then, play around with that form and try calling all it's methods, plus load & unload. Study the dumped log to understand when each event is generated.
I can assure you that will be useful information.
Regards,
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
|