Many of the examples C# Windows Forms programs posted off the class
page are a single source file (*.cs) or a source file with some
resources (*.gif or *.htm documentation files.
There are two ways you can run these examples.
- You can compile them using the command line C#
compiler (csc). To do this you will have to set you path for proper
searching. Please see Microsoft's on-line notes on using the .NET
Framework SDK v1.1.
- You can use an Interface Builder like Microsoft's Visual Studio
.NET 2003 or the open source forge Sharp Developer.
Using Microsoft's Visual Studio.NET 2003. This example describes how
to build the Hello585 example.
- Create a new visual studio .net 2003 C# Windows Application.
(e.g., Hello585 on the desktop)
- Right click on the *.cs file links off the class page, select save
target as, be sure you have text file (not html file) selected as
the file filter. Save the *.cs files in the directory you have
created for the C# Windows Application. (e.g., Hello585.cs and
Author.cs)
- From the Visual Studio .NET Project menu select add existing item.
Select the *.cs files you wish to add to the project. (e.g., You
now have Author.cs, Form1.cs, and Hello585.cs in your Hello585
project -- you can see this by opening the Solution Explorer
window).
- Remove the Form1.cs file if it is not needed, or was not copied
from the class page example. (e.g., it is not needed here -- it
was automatically created when the new Windows Application project
was created. If the example has a Form1.cs file you do not want
to remove it. You should see the file's name when you save it.)
You can do this by selecting the file in the solution explorer
window and right clicking then selecting "exclude from project".
Or you can select it in the solution explorer and then use the
Project memory to select "exclude from project". (e.g., now you
have Author.cs and Hello585.cs files in the project).
- From the Build menu select "build", or "rebuild".
- From the Debug menu select "Start without debugger". This option
will also cause the source file to be rebuilt if it has been
changed.