473,804 Members | 3,312 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why don't partial class files group?

I have a .NET 1.1 form that was migrated into 2.0. Its class file is
in form1.cs. I've created another "code" file named form1.designer. cs
and with this code:

partial class form1

in the same namespace as form1. form1.cs declares its class as

public partial class form1: Form

However, the designer file icon in solution explorer is labeled as c#
in green and not grouped under form1.cs. partial classes I've seen
created in the VS 2005 are always group under the root partial.

Is there something additional I need to do for this to happen?

Thanks,
Brett

Feb 8 '06 #1
4 2232
Brett Romero wrote:
However, the designer file icon in solution explorer is labeled as c#
in green and not grouped under form1.cs. partial classes I've seen
created in the VS 2005 are always group under the root partial.

Is there something additional I need to do for this to happen?


Hi Brett. The grouping of these files is not due to their containing parts
of the same class, but is rather something done by the designer wizard. If
you didn't run the wizard to create them in the new project, they won't be
grouped, although they will compile fine. The only way I know to deal with
this is to first create an identically named form using the wizard, then
close the project and copy the old source files over the generated files. I
hope this helps.
--
Derrick Coetzee, MCAD, MSFT (Speech Server)
This posting is provided "AS IS" with no warranties, and confers no
rights.
Feb 9 '06 #2
So the only way is to create a form? And from there you can't add any
new files to the same group (since the wizard only creates two partial
classes, including the master)?

Thanks,
brettr

Feb 10 '06 #3
Brett Romero wrote:
However, the designer file icon in solution explorer is labeled as c#
in green and not grouped under form1.cs. partial classes I've seen
created in the VS 2005 are always group under the root partial.

Is there something additional I need to do for this to happen?


The grouping of these files is not due to their containing parts
of the same class, but is rather something done by the designer wizard.


So the only way is to create a form? And from there you can't add any
new files to the same group (since the wizard only creates two partial
classes, including the master)?


Well, not from the GUI as far as I know, but if you're willing to go under
the hood there is a way to add files to groups like this. Open up the
project (.csproj) file in a text editor, and find the XML element that looks
like this:

<Compile Include="FileYo uWantInGroup.cs " />

Change it to this:

<Compile Include="FileYo uWantInGroup.cs ">
<DependentUpon> FileWhoseGroupI tGoesIn.cs</DependentUpon>
</Compile>

This should do what you want (I'm not sure if it has any other effects).
Normally, however, this is only used for files that are generated from or
otherwise dependent on the "root" file, as the name "DependentU pon" above
suggests. I hope this helps.
--
Derrick Coetzee, MCAD, MSFT (Speech Server)
This posting is provided "AS IS" with no warranties, and confers no
rights.
Feb 10 '06 #4
This is nice Derrick and it worked!

Thanks,
Brett

Feb 10 '06 #5

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

Similar topics

16
2656
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
2449
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 load as a 3rd partial class. This would be handy so i can generate standard code into one of the partial classes, while having my custom code untouched
7
1421
by: Maxwell2006 | last post by:
Hi, Typically partial classes consist of two .cs files. Can I have them in 3 source file? Thank you,
1
2639
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 receieved this error Error 1 Missing partial modifier on declaration of type 'NagyResearch.Q_A.Q.QuestionnairePage'; another partial declaration of this type exists D:\Web Sites\Local
3
3804
by: Brian Richards | last post by:
Is there a way to get Studio to group your partial class files in the Solution tree the way it automatically does with forms? (C#) Thanks Brian
3
3202
by: erich | last post by:
In VS2005, creating a new form creates the form class and a partial (frm*.designer.vb) class file and displays the partial class beneath the main form frm*.vb, which is great. However, when extracting the designer code elements from an existing form class into its own partial class, (or creating new ones) the partial class is displayed in the Solution Explorer under the Project name, that is, at the same level as the file from which it...
3
2579
by: Lau Lei Cheong | last post by:
A few quick questions: Is there a limitation on how much partial class files we can have for a single class? And can a ASP.NET page file inherit a class from multiple code-behind files? if so, do I need to point out all the codefiles in the page directive, or just one of them is enough?
3
1979
by: Aryan | last post by:
Hi, I have problem in creating Partial Class for ASPX pages. As my Codebase file for ASPX page is having more then 2500 lines of code. So its very hard to maintain the code. So I wanted to know, how can I create partial classes to handle this situation OR if I create new class files in App_Code folder to handle major code of ASPX code behind page then how can I get the access to the various Web Control which I have created on the ASPX...
6
1457
by: satyanarayan sahoo | last post by:
What’s the role of Partial keyword which is bydefault written for a class in 2.0 ? public partial class Form1 : Form
0
9588
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10589
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10327
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.