473,394 Members | 1,752 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,394 software developers and data experts.

using System.Windows.Forms in error??

Hi All,

I tried creating a C# Form using Petzold's "Programming MS Windows with C#"
guidance. He recommended using the namespace System.Windows.Forms.

However, VS.NET claims "the type or namespace name 'Windows' does not exist
in the class or namespace 'System'."

But I read it, MSDN seems to think it's fine at
http://msdn.microsoft.com/library/de...classtopic.asp.

Anybody know what's going on here?

Thanks in Advance,
Richard
Nov 17 '05 #1
5 9511
Richard,

Petzold? Who is he? What does he know?

Ok, I'm kidding.

Seriously though, you want to add a reference to
System.Windows.Forms.dll. You need the reference to the assembly in order
to use it.

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

"Richard Lionheart" <No***@Nowhere.net> wrote in message
news:OP**************@tk2msftngp13.phx.gbl...
Hi All,

I tried creating a C# Form using Petzold's "Programming MS Windows with
C#" guidance. He recommended using the namespace System.Windows.Forms.

However, VS.NET claims "the type or namespace name 'Windows' does not
exist in the class or namespace 'System'."

But I read it, MSDN seems to think it's fine at
http://msdn.microsoft.com/library/de...classtopic.asp.

Anybody know what's going on here?

Thanks in Advance,
Richard

Nov 17 '05 #2
> But as I read it, MSDN seems to think it's fine at
http://msdn.microsoft.com/library/de...classtopic.asp.
I just checked that MSDN page again and noted the bottom contains the note:
Syntax based on .NET Framework version 1.1. But my Help | About page for my
VS.NET Pro 2002 installation lists only Framework 1.0.

So my problem is that VS.NET doesn't honor my Framework 1.1 installation.

I've got 1.1 installed correctly, I believe.
-- First, because when I bring up Control Panel | Add/Remove Programs, I
see 1.1 listed as a candidate for removal.
-- Second, and more importantly, in some contexts I see 1.1 listed as a
source of some server-generated web page created in VS.NET.
-- Finally, %HOMEDRIVE%\Program Files\Microsoft.NET\SDK has a ~200MB v1.1
subdirectory.

Anyone got a suggestion as to how I can get VS.NET to recognize that
Framework 1.1 is installed so that hopefully Petzold's stuff will work?
Thanks in Advance,
Richard

Nov 17 '05 #3
Hi Nicholas,

Thank you very much for replying to my question.
Petzold? Who is he? What does he know? He's an awesome guy, isn't he? And I love the founders of Wintellect, too.
Seriously though, you want to add a reference to
System.Windows.Forms.dll. You need the reference to the assembly in order
to use it.
I've got the .dll in %windir%\ServicePackFiles\i386. And I was under the
impression that "using System.Windows.Forms" IS a reference to that dll. So
isn't my real problem that VS.NET isn't looking in that directory to pick up
the .dll.

And that idea seems to be consistent with the problem I outlined in my
1:44am post, which I'll repeat here for your convenience:

==== From previous post
I just checked that MSDN page again and noted the bottom contains the note:
Syntax based on .NET Framework version 1.1. But my Help | About page for my
VS.NET Pro 2002 installation lists only Framework 1.0.

So my problem is that VS.NET doesn't honor my Framework 1.1 installation.

I've got 1.1 installed correctly, I believe.
-- First, because when I bring up Control Panel | Add/Remove Programs, I
see 1.1 listed as a candidate for removal.
-- Second, and more importantly, in some contexts I see 1.1 listed as a
source of some server-generated web page created in VS.NET.
-- Finally, %HOMEDRIVE%\Program Files\Microsoft.NET\SDK has a ~200MB v1.1
subdirectory.

Anyone got a suggestion as to how I can get VS.NET to recognize that
Framework 1.1 is installed so that hopefully Petzold's stuff will work?
==== End of previous post

I checked VS.NET's tools' customize and options menu items but didn't see
anyway to add the name of the directory that houses the dll. (VS 6.0 had a
mechanism for doing that kind of thing. Where is it when we need it?)

If there's another way to reference that .dll, I appreciate learning how to
do it.
Hope this helps.

It certainly does.

Thanks again for replying.
Richard
Nov 17 '05 #4
Richard,

That's the thing, the using statement does not mean that you are setting
a reference. It is just a way of allowing you to use the
non-namespace-qualified names of a class. In other words, it allows you to
do this:

TextBox textBox;

Instead of:

System.Windows.Forms.TextBox textBox;

If you want to add a reference, go to your project, and right click on
the folder in your project labeled "references" and select "Add reference".
Then select System.Windows.Forms.dll from the dialog that appears.

Also, the location you specified is a backup due to an OS patch. The
true location is something like:

c:\windows\microsoft.net\<version>\System.Windows. Forms.dll

However, you shouldn't have to pick that, as VS.NET will show you the
correct version in the add reference dialog.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Richard Lionheart" <No***@Nowhere.net> wrote in message
news:ca********************@adelphia.com...
Hi Nicholas,

Thank you very much for replying to my question.
Petzold? Who is he? What does he know?

He's an awesome guy, isn't he? And I love the founders of Wintellect,
too.
Seriously though, you want to add a reference to
System.Windows.Forms.dll. You need the reference to the assembly in
order to use it.


I've got the .dll in %windir%\ServicePackFiles\i386. And I was under the
impression that "using System.Windows.Forms" IS a reference to that dll.
So isn't my real problem that VS.NET isn't looking in that directory to
pick up the .dll.

And that idea seems to be consistent with the problem I outlined in my
1:44am post, which I'll repeat here for your convenience:

==== From previous post
I just checked that MSDN page again and noted the bottom contains the
note:
Syntax based on .NET Framework version 1.1. But my Help | About page for
my
VS.NET Pro 2002 installation lists only Framework 1.0.

So my problem is that VS.NET doesn't honor my Framework 1.1 installation.

I've got 1.1 installed correctly, I believe.
-- First, because when I bring up Control Panel | Add/Remove Programs, I
see 1.1 listed as a candidate for removal.
-- Second, and more importantly, in some contexts I see 1.1 listed as a
source of some server-generated web page created in VS.NET.
-- Finally, %HOMEDRIVE%\Program Files\Microsoft.NET\SDK has a ~200MB v1.1
subdirectory.

Anyone got a suggestion as to how I can get VS.NET to recognize that
Framework 1.1 is installed so that hopefully Petzold's stuff will work?
==== End of previous post

I checked VS.NET's tools' customize and options menu items but didn't see
anyway to add the name of the directory that houses the dll. (VS 6.0 had
a mechanism for doing that kind of thing. Where is it when we need it?)

If there's another way to reference that .dll, I appreciate learning how
to do it.
Hope this helps.

It certainly does.

Thanks again for replying.
Richard

Nov 17 '05 #5
Hi Nicholas,

Success!! Many thanks for your mentoring.
It is just a way of allowing you to use the non-namespace-qualified names
of a class.
Now that you tell me, I remember reading this before. But this time it
will stick in my feeble brain :-)
right click on the folder in your project labeled "references"
If I may be so bold as to criticize my mentor, I would say "look in the
Solution Explorer pane in VS.NET ...". I wasted a few minutes looking at my
project in Windows Explorer, but those few minutes were well worth the
price of reaching that nugget that got my project moving.
Also, the location you specified is a backup due to an OS patch. So I should keep it in case an uninstall (of a Framework version I suppose)
becomes necessary
The true location is ...: Right on! I've got "%windir%\Microsoft.NET\Framework"
with subdirectories v1.0.3705 and v1.1.4322.
However, you shouldn't have to pick that, as VS.NET will show you the
correct version in the add reference dialog.

It turned out that the Add Reference dialog *did* list
System.Windows.Forms.dll, but the OK button was disabled.

When I opened the Select Component dialog, it positioned itself at
"%windir%\ServicePackFiles\i386" which had the .DLL created/mod'd July 19,
2004, 5:54:22 PM and sized 2,002,944 bytes.

On the other hand I navigated to
"%windir%\Microsoft.NET\Framework\v1.1.4322",
the .DLL was created/mod'd earlier July 15, 2004, 1:32:02 PM but was
larger: 2,052,096 bytes.

I went with default (ServicePackFiles) directory. VS.NET indicated, as I
understand it, that it was adjusting the other references in this project to
the versions from the same directory. I checked the paths for all the
references and the were indeed set to ServicePackFiles, save one: System.

That's the approach I going with hereafter. Does that sound right to you?

Best wishes and many thanks,
Richard

Nov 17 '05 #6

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

Similar topics

4
by: Charts | last post by:
I have a C# console application and I need pop up a Messagebox. However the IntelliSense does not show for using System.Windows.Forms; So, the application does not recognize the MessageBox. Please...
7
by: tongueless | last post by:
Whenever I have "using System.Windows.Forms.VisualStyles" in any project, VS2005 tells me that "'VisualStyles' does not exist in the namespace 'System.Windows.Forms.' Any idea what this might be?...
9
by: garyusenet | last post by:
I am using a C# solution that somebody kindly sent me. It was a console application. I am trying to get use of the MessageBox. I have added the following using directive to the namespaces at...
0
by: Patel | last post by:
Hi All, I am doing one INTERESTING work with Context Menu Strip. I am trying to insert a custom control / .Net control in Context menu as a context menu strip. I tried inserting MonthCalender in...
3
by: cbkprasad | last post by:
When I am trying to use the HtmlWindow Class in ASP.Net using C# language ,I am getting an error stating that no default constructor is defined for HtmlWindow class. I tryied just by getting...
1
by: =?Utf-8?B?WmlnZ3lTaG9ydA==?= | last post by:
Using a Button control, I tried to reset its colour ("color" to those of you on the other side of the pond). I tried to use the BackColor attribute - but that is in System.Windows.Forms.Button....
3
by: piedpiper | last post by:
Dear All, When i use: using System.Windows.Forms; I get the following error when compiling: Error 3 : The type or namespace name 'Windows' does not exist in the namespace 'System' (are you...
5
by: PeteOlcott | last post by:
I am getting compile time errors from the following line: using namespace System::Windows::Forms; Error 1 error C3083: 'Windows': the symbol to the left of a '::' must be a type Error 2 ...
2
satiss7pwr
by: satiss7pwr | last post by:
i have one window application developed in VS 2005 which is running successfully on client side,My question is that now i want to convert this window application in WPF browser based application, so...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
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.