470,602 Members | 1,664 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,602 developers. It's quick & easy.

The type or namespace name "Application" could not be found

Hi,
I am a beginner in .NET.
I am creating a new project. At begin I created this project with a form,
then a class."start"
I want to use class "start" as start point for this program. In this class I
wrote:
[STAThread]

static void Main()

{

Application.Run(new start());

}

But I can not build, compile the project, the error is:
The type or namespace name "Application" could not be found

What can I do?

Thanks
Nhan
Nov 16 '05 #1
6 17903
Le, Thanh-Nhan <le*****@freenet.de> wrote:
I am a beginner in .NET.
I am creating a new project. At begin I created this project with a form,
then a class."start"
I want to use class "start" as start point for this program. In this class I
wrote:
[STAThread]

static void Main()

{

Application.Run(new start());

}

But I can not build, compile the project, the error is:
The type or namespace name "Application" could not be found

What can I do?


Make sure you have "using System.Windows.Forms;" in your list of using
directives.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
psg
"Le, Thanh-Nhan" <le*****@freenet.de> wrote in message
news:uC**************@TK2MSFTNGP14.phx.gbl...
The type or namespace name "Application" could not be found


Application is a member of System.Windows.Forms namespace.
So You need to add
"using System.Windows.Forms;" line at the beginning
or change Your line to
"System.Windows.Forms.Application.Run(new start());"

Additionally You may need to add "System.Windows.Forms.dll" to Your project
references.

RGDS PSG
Nov 16 '05 #3
I have now the line:
using System.Windows.Forms;

then I have the compile error: "The best overloaded method match for
"System.Windows.Forms.Application.Run(System.Windo ws.Forms)" has some
invalid
argument"

OK, I can understand, the object parameter must be a form object, my "start"
class is any form, is only a normal class.
How can I do? Is it possible, to use a normal class (as in java, or VB6) as
start point for a program?

Nhan

"Jon Skeet [C# MVP]" <sk***@pobox.com> schrieb im Newsbeitrag
news:MP************************@msnews.microsoft.c om...
Le, Thanh-Nhan <le*****@freenet.de> wrote:
I am a beginner in .NET.
I am creating a new project. At begin I created this project with a form, then a class."start"
I want to use class "start" as start point for this program. In this class I wrote:
[STAThread]

static void Main()

{

Application.Run(new start());

}

But I can not build, compile the project, the error is:
The type or namespace name "Application" could not be found

What can I do?


Make sure you have "using System.Windows.Forms;" in your list of using
directives.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #4
Thanks
please see my posting to Jon Skeet
Nhan
"psg" <pg******@ki.net.pl> schrieb im Newsbeitrag
news:cq**********@b177.ki.net.pl...
"Le, Thanh-Nhan" <le*****@freenet.de> wrote in message
news:uC**************@TK2MSFTNGP14.phx.gbl...
The type or namespace name "Application" could not be found
Application is a member of System.Windows.Forms namespace.
So You need to add
"using System.Windows.Forms;" line at the beginning
or change Your line to
"System.Windows.Forms.Application.Run(new start());"

Additionally You may need to add "System.Windows.Forms.dll" to Your

project references.

RGDS PSG

Nov 16 '05 #5
psg
"Le, Thanh-Nhan" <le*****@freenet.de> wrote in message
news:Os**************@TK2MSFTNGP11.phx.gbl...
OK, I can understand, the object parameter must be a form object
Yes one of options is Form.
my "start" class is any form, is only a normal class.
How can I do? Is it possible, to use a normal class (as in java, or VB6)
as
start point for a program?


In a Main function You can Initialize Your "start" class ("start myStart =
new start();") and run its methods or if start() is only a method/function
of current class You can run it through e.g. "start();"

RGDS PSG

Nov 16 '05 #6
OK, thanks.

in Main function (static void Main() ) I call: start app = new start();
then in contructor of class start, I do everything.

"psg" <pg******@ki.net.pl> schrieb im Newsbeitrag
news:cq**********@b177.ki.net.pl...
"Le, Thanh-Nhan" <le*****@freenet.de> wrote in message
news:Os**************@TK2MSFTNGP11.phx.gbl...
OK, I can understand, the object parameter must be a form object


Yes one of options is Form.
my "start" class is any form, is only a normal class.
How can I do? Is it possible, to use a normal class (as in java, or VB6)
as
start point for a program?


In a Main function You can Initialize Your "start" class ("start myStart =
new start();") and run its methods or if start() is only a method/function
of current class You can run it through e.g. "start();"

RGDS PSG

Nov 16 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Microsoft | last post: by
2 posts views Thread by Arjen | last post: by
13 posts views Thread by Bob Day | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.