Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / December 2005

Tip: Looking for answers? Try searching our database.

Breaking Forms in to partial classes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rene - 16 Dec 2005 06:32 GMT
VS 2005 uses the Partial Class & <form>.Designer.cs for its windows forms
generated code.

When upgrading from 2003 the project wizard did not break the form, it left
it the old way. I would like to split them. Who the heck do you do that?
Other than using the IDE and add a new Form, I was not able to insert the
partial Form class in the nice hierarchical way the IDE does it. How do you
do that?

Thanks.
Ignacio Machin ( .NET/ C# MVP ) - 16 Dec 2005 20:31 GMT
Hi,

AFAIK there is no way of doing it. It would be nice though.

cheers,

Signature

Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

> VS 2005 uses the Partial Class & <form>.Designer.cs for its windows forms
> generated code.
[quoted text clipped - 6 lines]
>
> Thanks.
Richard Grimes - 17 Dec 2005 21:29 GMT
> VS 2005 uses the Partial Class & <form>.Designer.cs for its windows
> forms generated code.
[quoted text clipped - 4 lines]
> able to insert the partial Form class in the nice hierarchical way
> the IDE does it. How do you do that?

Edit the csproj file by hand?

for example, for Form1.cs I find these entries:

<Compile Include="Form1.cs">
  <Subtype>Form<Subtype>
</Compile>
<Compile Include="Form1.Designer.cs">
  <DependentUpon>Form1.cs</DependentUpon>
</Compile>

I took a VS2003 form file and separate it out into two partial classes
(putting InitializeComponent and Dispose in Form2.Designer.cs). Then
(with the solution closed) I copied the lines above and replaced Form1
with the name of my C# file(s) and everything worked.

Richard
Signature

Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
Security Tutorial:
http://www.grimes.demon.co.uk/workshops/securityWS.htm

Rene - 17 Dec 2005 23:11 GMT
Thanks Richard .

Hmmmm.... Now if I could only figure out why they decided to put the
InitializeComponent() in the From class instead of the Designer class......

>> VS 2005 uses the Partial Class & <form>.Designer.cs for its windows
>> forms generated code.
[quoted text clipped - 22 lines]
>
> Richard

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.