How to split a form when coding?

  • Thread starter Thread starter Peter
  • Start date Start date
P

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
 
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.
 
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
 
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.
 
Back
Top