|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to split a form when coding?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. 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 > > > 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. 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 > > |
|||||||||||||||||||||||