c# - Can't use System.Windows.Forms -
i have tried making (my first) 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, if 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 error get:
error 1 type or namespace name 'windows' not exist in namespace 'system' (are missing assembly reference?) c:\users\ramy\documents\visual studio 2010\projects\consoleapplication1\consoleapplication1\program.cs 5 14 consoleapplication1
some details: - using visual studio 2012; - have installed .net development kit; - console application.
maybe it's because on console application can't use system.windows.forms? if so, program should be? have tried form, displaying window , no code.
a console application not automatically add reference system.windows.forms.dll.
right-click project in solution explorer , select add reference... , find system.windows.forms , add it.
Comments
Post a Comment