473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Breaking Forms in to partial classes

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.
Dec 16 '05 #1
3 3899
Hi,

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

cheers,

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

"Rene" <no****@nospam.com> wrote in message
news:Ot**************@tk2msftngp13.phx.gbl...
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.

Dec 16 '05 #2
Rene wrote:
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?


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
--
Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
Security Tutorial:
http://www.grimes.demon.co.uk/workshops/securityWS.htm
Dec 17 '05 #3
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......

"Richard Grimes" <ri******@mvps.org> wrote in message
news:us**************@tk2msftngp13.phx.gbl...
Rene wrote:
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?


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
--
Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
Security Tutorial:
http://www.grimes.demon.co.uk/workshops/securityWS.htm

Dec 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Gomaw Beoyr | last post by:
Two question about the "partial classes" (in the next wersion of ..NET). Question 1 ========== Will partial classes (in the next version of C#) have to be declared "partial" in ALL places. ...
16
by: pawel.pabich | last post by:
Hajo, I would like to have 2 my own partial classes. For example: Default.aspx.cs Default2.aspx.cs and they both will relate to Default.aspx page.
10
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and...
1
by: Bishoy George | last post by:
In a web application using asp.net 2.0 All my classes are partial classes. - I noticed that partial class cannot be inherited... is that true? - I tried to remove the partial keyword , and I...
9
by: Fat Elvis | last post by:
I'd like to extend some of my Asp.net pages by using Partial Classes. Example ASP.Net Page: public partial class Admin_Customer : System.Web.UI.Page { protected void Page_Load(object sender,...
5
by: Johndoe | last post by:
Hi, Can someone give me some pointers as to how to convert a WinForms 1.1 to 2.0 to use partial classes? Maybe a good article on the Net? I already converted my application from 1.1 to 2.0, but...
5
by: Sagar | last post by:
I am working on a migration project for a huge asp.net application now running in framwework 1.1 to dotnet 2.0 As a first step, I opened the .sln files of the project in VS.Net 2005. The...
2
by: Peted | last post by:
Hi, im moving a project from vs2005 to vs 2008. is doing so i have come across a compiler error regarding partial classes that i dont understand if anyone can explain it to me please the...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.