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 / June 2006

Tip: Looking for answers? Try searching our database.

How to tell VS not to treat a class as a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MuZZy - 29 Jun 2006 23:20 GMT
Hi,

I just wonder if someone came across this small problem: i add a class
file to the C# project and i implement a class derived from Form. Even
though i don't have a resx file assosiated with it VS still treats it as
a form file and on double click it tries to open a form instead of
opening code. I made change directly to the project file specifying that
this file is "code", but VS overrides it.

I havee bunch of those files (where i have form classes or user control
classesbut want VS to treat those as regular classes and not try to show
designer for them ) and it's kind of inconvenient to open those by right
click and choose "View code" rather that just double clicking.

Any ideas?

Thank you,
MuZZy
Robbe Morris [C# MVP] - 30 Jun 2006 02:22 GMT
Forms are classes. You are also inheriting the class Form.
How would visual studio which developers want
the form to render in the designer and which developers don't.

Just right click the class and click View Code.  It
can't be that "inconvenient".

Signature

Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp

> Hi,
>
[quoted text clipped - 14 lines]
> Thank you,
> MuZZy
tlkerns - 30 Jun 2006 04:33 GMT
Also, you can right-click on one of those files and click Open With ...
Select CSharp Editor and then click the Set as Default & OK buttons.
From then on you'll be able to double-click those files to open them in code
view.

Tony

> Forms are classes. You are also inheriting the class Form.
> How would visual studio which developers want
[quoted text clipped - 21 lines]
> > Thank you,
> > MuZZy
MuZZy - 30 Jun 2006 04:51 GMT
> Also, you can right-click on one of those files and click Open With ...
> Select CSharp Editor and then click the Set as Default & OK buttons.
> From then on you'll be able to double-click those files to open them in code
> view.

That's actually a very good idea! I open code times more often than
designer so it shoudl work well for me!

Thanks a lot!

> Tony
>
[quoted text clipped - 23 lines]
>>> Thank you,
>>> MuZZy
MuZZy - 30 Jun 2006 04:50 GMT
> Forms are classes. You are also inheriting the class Form.
> How would visual studio which developers want
> the form to render in the designer and which developers don't.

Well, for example if there is no associated *.resx file it's logically
to treat that class as just class - anyway VS will fail to load designer
if there is no *.resx for *.cs

> Just right click the class and click View Code.  It
> can't be that "inconvenient".
Linda Liu [MSFT] - 30 Jun 2006 04:57 GMT
Hi MuZZy,

Thank you for posting.

Once you inherit a class from Form, the class is of type Form which has a
UI. When you double click a class with a UI in Solution Explorer, it is the
default behavior for VS to display it in the designer. As far as I know,
there is no way to change this default behavior.

If you want to display a class with a UI in a code view, you could select
this class in Solution Explorer and click the View Code button on the head
of the Solution Explorer, or press F7.

Hope this helps.
If you have anything unclear, please don't hesitate to let me know

Sincerely,
Linda Liu
Microsoft Online Community Support

====================================================
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
====================================================
C# Newbie - 30 Jun 2006 20:27 GMT
View-->Class View. In the Class View tab open any form, you won't get the
GUI...

my 2 cents...

> Hi,
>
[quoted text clipped - 14 lines]
> Thank you,
> MuZZy

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.