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 / Windows Forms / WinForm General / March 2008

Tip: Looking for answers? Try searching our database.

Partial classes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dbuchanan - 06 Feb 2008 04:40 GMT
Hello,

I made a test project to understand how adding my own partial class to a
form works. It wasn't so easy. I guess it would get easier after I get used
to it.

My question: Why does a partail class for a form not nest itself under the
main form class the way the default partial class (Form1.Designer.cs and
Form1.rsex) does?

I get this...
Form1.Bindings.cs
Form1.cs
>Form1.Desinger.cs
>Form1.resx

Instead of getting this...
Form1.cs
>Form1.Bindings.cs
>Form1.Desinger.cs
>Form1.resx

Am I doing something wrong?

Douglas
Jeffrey Tan[MSFT] - 06 Feb 2008 07:08 GMT
Hi Douglas,

This is basicly a VS IDE issue instead of being controlled by .Net Winform
designer, so you'd better post in microsoft.public.vsnet.ide newsgroup in
future.

Anyway, this is actually an undocumented feature of VS IDE. If you use
notepad to open the project file [XXX].csproj, you can find the snippet
like this:

<ItemGroup>
   <Compile Include="Form5.cs">
     <SubType>Form</SubType>
   </Compile>
   <Compile Include="Form5.Designer.cs">
     <DependentUpon>Form5.cs</DependentUpon>
   </Compile>
   <Compile Include="Program.cs" />
   <Compile Include="Properties\AssemblyInfo.cs" />
   <EmbeddedResource Include="Form5.resx">
     <SubType>Designer</SubType>
     <DependentUpon>Form5.cs</DependentUpon>
   </EmbeddedResource>
   <EmbeddedResource Include="Properties\Resources.resx">
     <Generator>ResXFileCodeGenerator</Generator>
     <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     <SubType>Designer</SubType>
   </EmbeddedResource>
   <Compile Include="Properties\Resources.Designer.cs">
     <AutoGen>True</AutoGen>
     <DependentUpon>Resources.resx</DependentUpon>
   </Compile>
   <None Include="Properties\Settings.settings">
     <Generator>SettingsSingleFileGenerator</Generator>
     <LastGenOutput>Settings.Designer.cs</LastGenOutput>
   </None>
   <Compile Include="Properties\Settings.Designer.cs">
     <AutoGen>True</AutoGen>
     <DependentUpon>Settings.settings</DependentUpon>
     <DesignTimeSharedInput>True</DesignTimeSharedInput>
   </Compile>
</ItemGroup>

These XML style attributes tell the VS IDE how to treat and open various
source *.cs files in the IDE designer. For example, <SubType>Form</SubType>
tells the IDE to launch form designer to view&edit the *.cs file. While
<DependentUpon>Form5.cs</DependentUpon> tells the IDE to place the current
*.cs item nested under "Form5.cs". So I think <DependentUpon> is what you
wanted.

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
dbuchanan - 07 Feb 2008 03:44 GMT
Wow Jeffrey,
Thanks a lot.

I changeed this...
   <Compile Include="Form1.Bind.cs">
     <SubType>Form</SubType>
   </Compile>

to this...
   <Compile Include="Form1.Bind.cs">
     <DependentUpon>Form1.cs</DependentUpon>
   </Compile>

Douglas
Jeffrey Tan[MSFT] - 07 Feb 2008 06:50 GMT
Glad to see it works for you. If you need further help, please feel free to
post, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
kyo - 27 Mar 2008 12:40 GMT
you can download free addin to visual studio from here:
http://www.kooriyoo.com/VSCommands/Default.aspx
and group items from VS IDE without need to add DependentUpon manually
to project file.

Rate this thread:







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.