Coby,
I have several generic forms in projects that I use to "do stuff", such as progress bars, custom message boxes and prompts etc.
I implemented them this way.
1. Create the form, in the form create a member variable, I tend to call mine m_KeepAlive.
2. Create a method to act as the form initialiser. I call mine Init. You can
use this to pass important information such as prompt messages etc.
3. In the Init method, set m_KeepAlive to True and Me.Visible = True.
4. Then call a method that will perform a Do..Loop Until m_KeepAlive = False.
5. You can then set m_KeepAlive to FALSE whenever you want the form to close.
Outside of that form, you have your "calling" code. Here you want something like:
Code:
Dim frm as New PromptForm 'Create instance of the form. - This will be hidden.
frm.Init ( Args ) 'Call the Init method with args. This will make the form visible and set any specific details.
'This will also put the form into an endless look (until m_KeepAlive = False) and no further code here will be executed. Once m_KeepAlive = False, the code will continue here and the form can be destroyed.
Oh, and of course if you need access to form information, create properties.
Hope this helps, I find it great as allows you to drag-n-drop into new projects, as all the form code is encapsualted.
Regards,
Rob
<center>
"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".
Thomas Jefferson</center>