Read Microsoft Visual C# 2005 Express Edition: Build a Program Now! Online
Authors: Patrice Pelland
Tags: #General, #Computers, #C♯ (Computer program language), #Programming Languages, #C#, #Microsoft .NET Framework, #Computer Books: Languages, #Computer Graphics, #Application software, #C# (Computer program language), #Programming, #Microsoft Visual C# .NET, #Microsoft Visual C♯ .NET, #Electronic books, #Game Programming & Design, #Computing: Professional & Programming, #C (Computer program language), #Computers - Languages, #Programming Languages - C#, #Programming & scripting languages: general
this is one of the best places to get answers. Whether you need help with some C# con
my advice to you is to go beyond
these examples and just try and
structs, or you want to see a list of How To articles, or you simply want hyperlinks to
try and try . . .
communities of programmers, you can often find help in the Getting Started section of the IDE.
■
Visual C# Express Headlines
This is where you find specific news about Visual C#
Express coming from Microsoft. These product headlines deliver special messages specific to Visual C# 2005 Express Edition and announce new updates, new releases, new code snippets, or anything that needs special attention on your part.
Chapter 3: Creating Your First Application
29
CSX_chapter3.indd 29
CSX_chapter3.indd 29
10/24/05 3:03:18 PM
10/24/05 3:03:18 PM
■
MSDN Feeds
This section of the Start Page includes hyperlinks to articles from one of
The Microsoft Developer Network
the
MSDN RSS
(Microsoft Developer Network Really Simple Syndication) feeds. These
(MSDN) is a set of online and
offline services designed to help
articles can be configured to any valid RSS feed from the Web. The default is set to the
developers write applications
MSDN® Visual C# 2005 Express RSS feed. These articles are different from the Visual C#
using Microsoft products and
technologies.
Express Headlines; occasionally, they might be the same, but the articles from MSDN
cover not only C# Express but all topics including Visual
Studio Team Systems, Microsoft SQL Server™, Web Services,
If you don't see Startup and other
settings in the Options dialog box,
Some hyperlinks on the Start page
and so forth. You can modify the feed by selecting Options
ensure that you select the Show
require a live connection to the
from the Tools menu, expanding Environment, selecting
All Settings check box in the lower
Internet. So, if you are unable to
left corner of the Options dialog
read the hyperlinks, please verify
Startup, and updating the Start Page News Channel field
box.
your Internet connection status.
with a valid RSS feed of your choice.
IDE Components
Some important components of the IDE are not part of the Start page.
■
Menu Bar
This is where you can select and perform almost all possible actions related to your projects, files, and Help. The available options change based on the current context. For example, when you don’t have an open project you have fewer menu choices: only File, Edit, View, Tools, Window, Community, and Help. When a project is open, the menu choices will also include Project, Build, Debug, and Data.
■
Main Toolbar
This toolbar contains icons that are essentially shortcuts to actions that you can also perform by going through the menus.
■
Toolbox
If you scroll over the toolbox on the left side of the Start Page screen, it will expand. If there is no opened project, the toolbox should be empty. The toolbox contains controls that are used in your applications. At this point you can think of controls as visual elements in Windows applications that possess a graphical interface. For instance, once a project is opened, the toolbox will include buttons, labels, text box controls, menus, toolbars, and so on. These controls are defined and explained in greater detail in Chapter 5.
■
Solution Explorer
This feature lists the files and components in your project. If no project is open, it should be empty. You’ll see more details about the Solution Explorer later in this chapter.
30
Microsoft Visual C# 2005 Express Edition: Build a Program Now!
CSX_chapter3.indd 30
CSX_chapter3.indd 30
10/24/05 3:03:18 PM
10/24/05 3:03:18 PM
■
Status Bar
The status bar displays a wide variety of information corresponding to the state of certain active operations. For instance, when you load a project you’ll see a message on your screen such as “Loading project c:\blabla\blabla.csproj from your hard drive.” When you’re building an application you’ll see something like “build started;” and when the application has finished, you’ll see “Build succeeded” or “Build failed” depending on the success of the process.
On to the Projects
From this point on, you’ll focus on what you really came here to do: build some projects. So
let’s start with your first application. First, you’ll build the console version of the application.
For demos and samples, I recom-
mend that you type in all the
source code so you can see and
better understand concepts.
Building a Console Application
However, for longer source code
listings, you can also download the
We’ve been talking about what a console application can do and what it will look like, so
completed code samples.
(
http://www.microsoft.com/mspress/
why don’t we build one? In this section, you’ll create a simple mathematic application.
companion/0-7356-2229-9/
)
TO BUILD A CONSOLE APPLICATION
If Visual C# 2005 Express Edition is not running, start it by clicking
Start/All Programs/Microsoft
1
Visual C# 2005 Express Edition
.
You can choose to start building your application either by clicking the
New Project
icon on the tool2 bar, by selecting
Create: Project
. . . from the Start Page, or by clicking
File/New Project
on the menu bar.
In the New Project dialog box, select
Console Application
in the Templates section, and type
MyFirst
3
ConsoleApplication
in the Name box. The New Project dialog box should be similar to the one in Figure 3-5. Click
OK
when you’re ready to go to the next step.
Chapter 3: Creating Your First Application
31
CSX_chapter3.indd 31
CSX_chapter3.indd 31
10/24/05 3:03:19 PM
10/24/05 3:03:19 PM
By default in Visual C# 2005
Express Edition, when you click
OK, projects are created in a tem-
porary location. When you save or
close the project, files are saved
in My Documents\Visual Studio
2005\Projects. You can change the
default projects location by going
to Tools/Options/Projects and
Solutions and finding the first text
box named Visual Studio Projects
location. You’ll look into what
those files are and what they’re
content is later in this chapter and
also in Chapter 5.
Figure 3-5
Creating a console application using
the New Project dialog box
You should now see the IDE in an idle state waiting for you to write the application’s code. Your screen should now look like the one shown here in Figure 3-6.
Getting to Know Solution Explorer
Before you write the code, you need to learn about the Solution Explorer. As seen on the right side of the screen in Figure 3-6, the Solution Explorer provides an organized view of your projects and all the files that are associated with them, as well as some useful commands in the form of a toolbar. You’ll find all the source code files, the project settings, resource files (like the application icon), configuration files, and so on in the Solution Explorer.
If the Solution Explorer disappears
for any reason, you can get it back
by going to the View menu and
selecting Solution Explorer.
32
Microsoft Visual C# 2005 Express Edition: Build a Program Now!
CSX_chapter3.indd 32
CSX_chapter3.indd 32
10/24/05 3:03:19 PM
10/24/05 3:03:19 PM
Note that the Start Page is still
available; it’s simply in a separate
tab. You can go to any window by
clicking a specific tab or by press-
ing Ctrl+Tab.
Figure 3-6
MyFirstConsoleApplication without the code
If you want more information about the Solution Explorer you can always do a search in the Help system and product documentation. Before trying to perform a search, please read the next section; you’ll learn a lot about all the information that is at your disposition.
Getting Help: Microsoft Visual Studio
2005 Express Edition Documentation
If you want to read more about the Solution Explorer, you need to be introduced to the Help and the documentation systems. You access the documentation by pressing F1 from
Chapter 3: Creating Your First Application
33
CSX_chapter3.indd 33
CSX_chapter3.indd 33
10/24/05 3:03:20 PM
10/24/05 3:03:20 PM
within Visual C# 2005 Express Edition or by going through the Help menu. The first time you press F1 or go through the Help menu, you’ll be greeted with the Online Help Settings screen, as shown in Figure 3-7.
This screen prompts you to choose a primary help source; you can choose online Help as a primary source, local Help as a primary source, or no online Help at all. Think about your options carefully. If you don’t have a
broadband (cable, DSL, or satellite)
Internet connection, I suggest you
choose the local Help as a primary
source; otherwise choose online Help
as your primary source since it is the
best source for the latest information.
Once you’ve made your selection,
you’ll see the documentation graphical
interface, as shown in Figure 3-8.
Figure 3-7
Online Help Settings choices
34
Microsoft Visual C# 2005 Express Edition: Build a Program Now!
CSX_chapter3.indd 34
CSX_chapter3.indd 34
10/24/05 3:03:21 PM
10/24/05 3:03:21 PM