I have tried making (my first) a C# program:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("hello");
Console.ReadLine();
}
}
}
This goes well, but if I try using System.Windows.Forms:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("hello");
System.MessageBox("hello");
Console.ReadLine();
}
}
}
This is the error I get:
Error 1 The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?) C:UsersRamyDocumentsVisual Studio 2010ProjectsConsoleApplication1ConsoleApplication1Program.cs 5 14 ConsoleApplication1
Some details:
- I am using Visual Studio 2012;
- I have installed the .NET Development Kit;
- It is a Console Application.
Maybe it's because on a Console Application can't use System.Windows.Forms?
If so, what program should be? I also have tried with a form, but I was only displaying a window and no code.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…