Multiple forms
-
I know this is a very basic question but could someone please tell me how to create for example a dialog box for getting user settings ect for my application, or even an about dialog box. Is it as simple as right clicking in the explorer and adding another windows form? If so how do I get my program to display it? Thanks in advance, Paddy.
-
I know this is a very basic question but could someone please tell me how to create for example a dialog box for getting user settings ect for my application, or even an about dialog box. Is it as simple as right clicking in the explorer and adding another windows form? If so how do I get my program to display it? Thanks in advance, Paddy.
Paddy wrote: Is it as simple as right clicking in the explorer and adding another windows form? Yes. Paddy wrote: If so how do I get my program to display it?
YourFrm frm = new YourFrm();
frm.ShowDialog();Mazy "The more I search, the more my need For you, The more I bless, the more I bleed For you."The Outlaw Torn-Metallica
-
I know this is a very basic question but could someone please tell me how to create for example a dialog box for getting user settings ect for my application, or even an about dialog box. Is it as simple as right clicking in the explorer and adding another windows form? If so how do I get my program to display it? Thanks in advance, Paddy.
You pretty much have it. It only requires adding another WinForm to your project. In the code you (assuming the name of the new WinForm class is 'Form2') simply something like:
Form2 dlg = new Form2();
dlg.ShowDialog();when you want to display the form. If can also use "dlg.Show()" if you wish a modeless window. Rocky Moore
-
You pretty much have it. It only requires adding another WinForm to your project. In the code you (assuming the name of the new WinForm class is 'Form2') simply something like:
Form2 dlg = new Form2();
dlg.ShowDialog();when you want to display the form. If can also use "dlg.Show()" if you wish a modeless window. Rocky Moore
-
Thanks for the help that solves that problem for me. One more question, whats the difference between a windows form and an inherited windows form? Thanks, Paddy.
Paddy wrote: One more question, whats the difference between a windows form and an inherited windows form? An inherited Winform is a cool little beast that allows you to inherit the WinForm from a WinForm that you create in another library (DLL) or you own project (if you compiler before you inherit). You can define one form as your base form with controls, then you inherit that form. It will build a form that looks just like the base form. You can add items to the form, you just cannot modify any of the items on the base form. But you can, at any time, modify the base form and those modifications will bubble up to all inherited forms.. Cool! This is good for a Wizard type window where you have a certian layout. Another use is to simulate a skinning window by creating the base winform with different graphics or colors then dropping in the any of the modified base class DLLs thus changing the appearance of all inherited WinForms that inherit from that base WinForm. There are many uses Inherited Forms! Rocky Moore