Home All Groups Group Topic Archive Search About

How to split a form when coding?

Author
14 Feb 2006 3:29 AM
Peter
Hi,

The main form of my project is verbose. It contains 26,000 lines of code and
many controls. These controls are located in three different TabPages of a
TabControl.There are also other tabcontrols on the main tabcontrol.

Is it possible to split a form in coding and then looks like a full well
form to user when excuting?

Thanks in advance

Peter

Author
14 Feb 2006 3:42 AM
Michael D. Ober
In VS 2005 you can use "Partial Classes" to logically seperate your code.
The IDE uses them to hide the form creation code.

Mike Ober.

Show quoteHide quote
"Peter" <zlxm***@sina.com> wrote in message
news:usruMaRMGHA.3052@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> The main form of my project is verbose. It contains 26,000 lines of code
and
> many controls. These controls are located in three different TabPages of a
> TabControl.There are also other tabcontrols on the main tabcontrol.
>
> Is it possible to split a form in coding and then looks like a full well
> form to user when excuting?
>
> Thanks in advance
>
> Peter
>
>
>
Author
14 Feb 2006 6:30 AM
Peter
Thank you, Michael.

Do you think it can also used in UI?  e.g. I put some controls on form1,then
I put some other controls on form2. After coding,I want to see all the
controls in one form when excuting.

Peter
Author
14 Feb 2006 8:25 AM
CMM
Kinda sorta... but it's not as cool as it could be. It's called Visual
Inheritance (if I remember correctly... nobody really uses it I don't
think).
In your form2 change "Inherits.System.Windows.Forms" (in the code-behind
hidden partial class if you're using VS2005) to "Inherits MyForm1"

Maybe they've improved this in VS2005. I doubt it.

Probably the best solution for your "separation" are UserControls.
UserControls are just containers. You can add a bunch of controls to them.
Then reuse them in as many forms as you want.

--
-C. Moya
www.cmoya.com
Show quoteHide quote
"Peter" <zlxm***@sina.com> wrote in message
news:eL08a$SMGHA.2580@TK2MSFTNGP14.phx.gbl...
> Thank you, Michael.
>
> Do you think it can also used in UI?  e.g. I put some controls on
> form1,then
> I put some other controls on form2. After coding,I want to see all the
> controls in one form when excuting.
>
> Peter
>
>
Author
15 Feb 2006 12:25 AM
Peter
Yes, one of my friend also suggested me to use UserControls.

Peter