By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 1,876 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

How can I get my VS2003 Form files splitted in 2 Partial class flies like in VS2005 ?

P: n/a
In VS 2005 Form files are in 3 parts : From1.cs, Form1.Designer.cs and
Form1.resx.

In VS 2003 there is only one ".cs files".

How can I split my old VS2003 ".cs files" files in 2 files : From.cs and
Form.Designer.cs, and get thoses file "grouped" in the Solution explorer
under the main Form.cs file ?

Thanks for Help !

Steph.
May 11 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Hello TheSteph,

In no way, VS 2003 doesnt support this

T> In VS 2005 Form files are in 3 parts : From1.cs, Form1.Designer.cs
T> and Form1.resx.
T>
T> In VS 2003 there is only one ".cs files".
T>
T> How can I split my old VS2003 ".cs files" files in 2 files : From.cs
T> and Form.Designer.cs, and get thoses file "grouped" in the Solution
T> explorer under the main Form.cs file ?
T>
T> Thanks for Help !
T>
T> Steph.
T>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
May 11 '06 #2

P: n/a
Hi,

You cannot, that is a new feature of VS 2005
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"TheSteph" <Th******@NoSpam.com> wrote in message
news:Ol**************@TK2MSFTNGP02.phx.gbl...
In VS 2005 Form files are in 3 parts : From1.cs, Form1.Designer.cs and
Form1.resx.

In VS 2003 there is only one ".cs files".

How can I split my old VS2003 ".cs files" files in 2 files : From.cs and
Form.Designer.cs, and get thoses file "grouped" in the Solution explorer
under the main Form.cs file ?

Thanks for Help !

Steph.

May 11 '06 #3

P: n/a
In fact I have imported in VS2005 a project that I began with VS2003. But
after Importing my project in VS2005, the Form files have not been split by
the "Import/Conversion wizard", and I would like to know if It is possible
to do it in automated way ? (I have +/- 50 Forms to convert.)

I have tried manually, it works BUT the Solution Explorer show the
From.Designer.cs files at the same level than the Form.cs. (the
Form.Designer.cs files should be a child of the Form.cs node and I don't
know how to do it.)

Thanks !

Steph.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:u4**************@TK2MSFTNGP05.phx.gbl...
Hi,

You cannot, that is a new feature of VS 2005
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"TheSteph" <Th******@NoSpam.com> wrote in message
news:Ol**************@TK2MSFTNGP02.phx.gbl...
In VS 2005 Form files are in 3 parts : From1.cs, Form1.Designer.cs and
Form1.resx.

In VS 2003 there is only one ".cs files".

How can I split my old VS2003 ".cs files" files in 2 files : From.cs and Form.Designer.cs, and get thoses file "grouped" in the Solution explorer
under the main Form.cs file ?

Thanks for Help !

Steph.


May 11 '06 #4

P: n/a
Steph,
What you are referring to is "Partial Classes" which is strictly a .NET 2.0
Framework feature. Since Visual Studio 2003 cannot target the 2.0 framework,
you are out of luck.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"TheSteph" wrote:
In VS 2005 Form files are in 3 parts : From1.cs, Form1.Designer.cs and
Form1.resx.

In VS 2003 there is only one ".cs files".

How can I split my old VS2003 ".cs files" files in 2 files : From.cs and
Form.Designer.cs, and get thoses file "grouped" in the Solution explorer
under the main Form.cs file ?

Thanks for Help !

Steph.

May 11 '06 #5

P: n/a
Hi,

"TheSteph" <Th******@NoSpam.com> wrote in message
news:ue**************@TK2MSFTNGP05.phx.gbl...
In fact I have imported in VS2005 a project that I began with VS2003. But
after Importing my project in VS2005, the Form files have not been split
by
the "Import/Conversion wizard", and I would like to know if It is possible
to do it in automated way ? (I have +/- 50 Forms to convert.)

No idea really, what you could try is open one of the forms in the designer
and see what happen, IMO it will not work though.
May 11 '06 #6

P: n/a
Steph,

There is no reason why it would split it apart. The code that you have
in .NET 1.1 is going to compile in .NET 2.0 (at least, for the most part).

The feature you are looking at is partial classes, which allows you to
separate a class definition into multiple files. The VS.NET people are
using this all over to separate the designer generated stuff from your
stuff.

Because it is not a requirement to use partial classes, the conversion
program doesn't touch it (since it isn't broke).

You might be able to get away with writing an app which will use CodeDOM
to parse your file, and then split it into two separate files, placing the
field declarations in one, and methods (except for InitializeComponent) in
another. In the end, it will not be easy though, since you can declare
fields anywhere in partial classes (and how do you know what you added, and
what was added previously by the designer).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"TheSteph" <Th******@NoSpam.com> wrote in message
news:ue**************@TK2MSFTNGP05.phx.gbl...
In fact I have imported in VS2005 a project that I began with VS2003. But
after Importing my project in VS2005, the Form files have not been split
by
the "Import/Conversion wizard", and I would like to know if It is possible
to do it in automated way ? (I have +/- 50 Forms to convert.)

I have tried manually, it works BUT the Solution Explorer show the
From.Designer.cs files at the same level than the Form.cs. (the
Form.Designer.cs files should be a child of the Form.cs node and I don't
know how to do it.)

Thanks !

Steph.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote
in message news:u4**************@TK2MSFTNGP05.phx.gbl...
Hi,

You cannot, that is a new feature of VS 2005
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"TheSteph" <Th******@NoSpam.com> wrote in message
news:Ol**************@TK2MSFTNGP02.phx.gbl...
> In VS 2005 Form files are in 3 parts : From1.cs, Form1.Designer.cs and
> Form1.resx.
>
> In VS 2003 there is only one ".cs files".
>
>
>
> How can I split my old VS2003 ".cs files" files in 2 files : From.cs and > Form.Designer.cs, and get thoses file "grouped" in the Solution
> explorer
> under the main Form.cs file ?
>
>
>
> Thanks for Help !
>
>
>
> Steph.
>
>



May 11 '06 #7

P: n/a


OK. I Googled a bit and It seems that there is no tool to do that
automatically...

I found the solution to manually get it working right, I share to anyone
interested :

1.. Have a model of a simple "Form.Designer.cs" file and follow the model.
2.. Copy the Form.cs file and rename the copy 'Form.Designer.cs"
3.. The 2 main tricks are here :
- Do NOT work on this "INSIDE" the SOLUTION or the project. It will works
but the "Form.Design.cs" files will not go under the Form.cs node in the
Solution explorer. You can use VS2005, but open only the .cs files you are
working on !

- "Form.Designer.cs" have natively no "using" clause : so you have to insert
the full path in front of the component that are in the Form : example :

private StatusBar StbMain;

will be replaced by :

private System.Windows.Forms.StatusBar StbMain;

- Once you finished working on the files. Close them. Open the
solution. The Form.Designer.cs file will be under the right Form.cs node,
but the designer.cs files are "grayed" and with a "white" icon. Just
Right-cLick the designer.cs files and select "Add File to Project"; the file
will be no more grayed and with the right Icon.

That's it....



Well... 49 files remainning...

Thanks !

Steph.

"TheSteph" <Th******@NoSpam.com> wrote in message
news:Ol**************@TK2MSFTNGP02.phx.gbl...
In VS 2005 Form files are in 3 parts : From1.cs, Form1.Designer.cs and
Form1.resx.

In VS 2003 there is only one ".cs files".

How can I split my old VS2003 ".cs files" files in 2 files : From.cs and
Form.Designer.cs, and get thoses file "grouped" in the Solution explorer
under the main Form.cs file ?

Thanks for Help !

Steph.

May 11 '06 #8

P: n/a


OK. I Googled a bit and It seems that there is no tool to do that
automatically...

I found the solution to manually get it working right, I share to anyone
interested :

1.. Have a model of a simple "Form.Designer.cs" file and follow the model.
2.. Copy the Form.cs file and rename the copy 'Form.Designer.cs"
3.. The 2 main tricks are here :
- Do NOT work on this "INSIDE" the SOLUTION or the project. It will works
but the "Form.Design.cs" files will not go under the Form.cs node in the
Solution explorer. You can use VS2005, but open only the .cs files you are
working on !

- "Form.Designer.cs" have natively no "using" clause : so you have to insert
the full path in front of the component that are in the Form : example :

private StatusBar StbMain;

will be replaced by :

private System.Windows.Forms.StatusBar StbMain;

- Once you finished working on the files. Close them. Open the
solution. The Form.Designer.cs file will be under the right Form.cs node,
but the designer.cs files are "grayed" and with a "white" icon. Just
Right-cLick the designer.cs files and select "Add File to Project"; the file
will be no more grayed and with the right Icon.

That's it....



Well... 49 files remainning...

Thanks !

Steph.

"TheSteph" <Th******@NoSpam.com> wrote in message
news:Ol**************@TK2MSFTNGP02.phx.gbl...
In VS 2005 Form files are in 3 parts : From1.cs, Form1.Designer.cs and
Form1.resx.

In VS 2003 there is only one ".cs files".

How can I split my old VS2003 ".cs files" files in 2 files : From.cs and
Form.Designer.cs, and get thoses file "grouped" in the Solution explorer
under the main Form.cs file ?

Thanks for Help !

Steph.

May 11 '06 #9

P: n/a
Take a look at this site:
http://webproject.scottgu.com/CSharp...migration.aspx

He's got a complete walkthrough for migrating 2003 projects to 2005 and
includes a description of how to convert the project to use partial
classes. While the created files might need some tweaking, it seems a
heck of a lot easier than doing it all by hand.

--Faulk

*** Sent via Developersdex http://www.developersdex.com ***
May 19 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.