okay, we'll welcome to the both of you.
To show a form, you can do it in a few ways.
If you want to show aform and stop the process from being able to execute any more comments until the form is close we would do this:
frmForm.Show vbmodal
what that means is say this scenario:
Code:
Form_Load()
on error goto ErrH
dim i as integer
i = 1000
i = i / 0
errH:
frmForm.Show vbmodal
Resume Next
end sub
now that will cause a 'Divide by Zero' error when you run it because of the i=i/0 line. We are using Eroror handling(first line under the Form_Load() statement) so it will goto the ErrH: area and execute what ever is underneath it. By running it in a Modal state we will stop the excution of commands until the form is dismissed by the user.
Now what if you didnt want to show the form and stop executing? Simple use the .Show method on the form.
Okay i hear you say "Okay smarty pants.. what if i want to float the form ontop of a form?(Eg. Form1 ontop of Form2?) huh? Huh? think you so smart try that one? come on comone? huh... wanna start me now? huh?"...
we'll no need to get so jumpy... we simply do this: form1.show , form2 where Form2 is the parent form of form1!
now when your unloading you forms its important to unallocate the memory that the form may be occupying. You can achieve this by this:
Code:
{rivate sub Form_Unload(cancel as integer)
On error resume next '// Just incase
set <form name> = nothing '// unallocatoin
End sub
As for loading and unloading as HyperHacker has said... you would use that if your intending to load a form prior to showing it, typical scenario is when you display a Splash screen, in the background all the forms are being loaded(yes theres a reason for the Splash screen and its not just for nice logos!)...
Does this help?