473,406 Members | 2,345 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,406 software developers and data experts.

C# can't create Window Forms?

Hello,

I downloaded 'Microsoft Visual C#' and the 'Programmers_Heaven_C_Schom.pdf'
to learn myself C#.

In the PDF it says that to create a Windows Form you need to add the line:
'using System.Windows.Forms'
but this 'using' is not in the auto-selection-list when typing nor is it
recognized by the compiler.

I can create a Window by menu: Project -Add Windows Form...'
but then also no 'using System.Windows.Forms' is showing anywhere.

What's the relation between both methods? How do I have to see these things?

Regards,

Henk (confused...;-) )
Jan 26 '07 #1
3 1809
OK - I'll assume you mean "Microsoft Visual C# 2005 Express
Edition"... using the standard templates, after Project -Add Windows
Form... the code in Form1.cs looks like below. As for it not
recognising System.Windows.Forms when entered manually, this sounds
like a missing reference. Ensure that your project references
System.Windows.Forms.dll; note that console apps and class libraries
(etc) don't reference this by default, but you can add it. Also,
Project -Add Windows Form... seems to conveniently add it for you.

Marc

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms; // EDIT: "here I am"

namespace MyTestApplication
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
Jan 26 '07 #2
Thanks.,

I surfed through the menu 'Project' and found that:

Projetc -Add Reference -System.Windows.Forms

does the right stuff.

(as I'm used to Borland C++ and Microsoft VB/VBA each language has it's own
approach
that has to be learned.....;-) )

Henk

"Marc Gravell" <ma**********@gmail.comschreef in bericht
news:ec**************@TK2MSFTNGP04.phx.gbl...
OK - I'll assume you mean "Microsoft Visual C# 2005 Express Edition"...
using the standard templates, after Project -Add Windows Form... the
code in Form1.cs looks like below. As for it not recognising
System.Windows.Forms when entered manually, this sounds like a missing
reference. Ensure that your project references System.Windows.Forms.dll;
note that console apps and class libraries (etc) don't reference this by
default, but you can add it. Also, Project -Add Windows Form... seems to
conveniently add it for you.

Marc

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms; // EDIT: "here I am"

namespace MyTestApplication
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}


Jan 26 '07 #3
(as I'm used to Borland C++ and Microsoft VB/VBA each language has it's
own approach
that has to be learned.....;-) )

Or in thus case you just didn't look very hard? ;) Read up on namespaces,
and in future use the 'find' command before posting such a question.
"Henk van Winkoop" <h.***********@wxs.nlwrote in message
news:45***********************@text.nova.planet.nl ...
Thanks.,

I surfed through the menu 'Project' and found that:

Projetc -Add Reference -System.Windows.Forms

does the right stuff.

(as I'm used to Borland C++ and Microsoft VB/VBA each language has it's
own approach
that has to be learned.....;-) )

Henk

"Marc Gravell" <ma**********@gmail.comschreef in bericht
news:ec**************@TK2MSFTNGP04.phx.gbl...
>OK - I'll assume you mean "Microsoft Visual C# 2005 Express Edition"...
using the standard templates, after Project -Add Windows Form... the
code in Form1.cs looks like below. As for it not recognising
System.Windows.Forms when entered manually, this sounds like a missing
reference. Ensure that your project references System.Windows.Forms.dll;
note that console apps and class libraries (etc) don't reference this by
default, but you can add it. Also, Project -Add Windows Form... seems
to conveniently add it for you.

Marc

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms; // EDIT: "here I am"

namespace MyTestApplication
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}



Jan 26 '07 #4

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

Similar topics

10
by: soup_or_power | last post by:
The pop up window has several checkboxes. I'm unable to access the checkboxes using the handle from window.open. Any way to do this? var display; function showSugg(but_id, sugg1, sugg2, sugg3,...
2
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of...
2
by: Greg Merideth | last post by:
Using Visual C# I created two forms such as namespace test { public class SystemTray : System.Windows.Forms.Form { public createwindow() { stuff here; } public fadewindow() { stuff to fade...
3
by: Sushil Srivastava | last post by:
Hi Guys, Would you be able to help me using C# GUI (with user interface component) in my MFC application. I have used managed extension, COM-interops, etc but problem is this C# component has...
4
by: Agnes | last post by:
I got a invoice form , and toolbar, as the user click search button. I want to prompt a little window with one textbox , "OK" button and "Cancel" button. as the user input the invoice_no, press OK...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
3
by: Siv | last post by:
Hi, A little while ago I wrote a small program that allowed the user to view products from a database. The database holds the details of the products which can be viewed via a form and...
20
by: Boki Digtal | last post by:
Hi All, How to limit the c# program can only run one instance at the same time ? Thank you! Best regards, Boki.
6
by: jojoba | last post by:
Hi, I am trying to create a .net webservice such that: When a user calls the service, the server creates a System.Windows.Forms.Form and shows it on the server screen. I know this sounds...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...
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.