Microsoft Visual C# 2005 Express Edition: Build a Program Now! (2 page)

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

BOOK: Microsoft Visual C# 2005 Express Edition: Build a Program Now!
6.8Mb size Format: txt, pdf, ePub

iii

A02622299.indd iii

A02622299.indd iii

10/24/05 5:18:50 PM

10/24/05 5:18:50 PM

Chapter 6

Chapter 9

Modify Your Web Browser Now!

81

Build Your Own Weather Tracker

Application Now!

165

How to Bring Up Your Application

82

Adding an About Box Dialog

89

Features of the Weather Tracker Application

166

Adding a Navigate Dialog Box

92

The High-Level Plan

167

Adding a Tool Strip Container and Some Tools

96

Creating the Application User Interface

168

Adding a Status Bar to Your Browser

98

Adding Notification Area Capabilities

169

Personalize Your Application with Windows Icons

102

Adding the Splash Screen and About Dialog Box

176

Adding the Options Dialog Box

179

Chapter 7

Using Web Services

181

Fixing the Broken Blocks

111

Debugging an Application

112

Using a DLL in an Application

112

Adding a Reference to Your Application

113

Breakpoints, Locals, Edit and Continue, and Visualizers

114

Chapter 8

Managing the Data

127

What Is a Database?

128

What’s In a Database?

128

Data Normalization and Data Integrity

129

What Is Null?

132

What Are Primary Keys and Foreign Keys?

132

How Do You Interact with a Relational Database?

135

SQL Server 2005 Express in Visual C# 2005 Express Edition 136

Creating a Database Using Visual C# 2005 Express Edition 137

Creating Tables in Your Database

139

Creating Relationships Between the Tables

141

Entering Data in SQL Server Tables Using Visual Studio

145

What Are ADO.NET and Databinding?

148

The Car Tracker Application Development

150

How Do I Get More Meaningful Information on My Form? 156

iv

Microsoft Visual C# 2005 Express Edition: Build a Program Now!

A02622299.indd iv

A02622299.indd iv

10/24/05 5:18:57 PM

10/24/05 5:18:57 PM

Introduction

Visual C# 2005 Express and the other Visual Studio 2005

This book is for people who have ideas but don’t know

Express Edition products are, in my opinion, one of the best

how to bring them to reality. It’s a good introduction to this

and most intelligent ideas to come out from Developer

art and science that is developing software.

Division here at Microsoft. I’m applauding and cheering

for the people who had this brilliant idea because I believe

How This Book Is Organized

there is a real need and demand for a world-class and powerful product for the hobbyist programmers, students, and This book consists of nine chapters, each covering a parprofessional developers. And Visual C# 2005 Express Edition ticular feature or technology about Visual C# 2005 Express

answers all of that and more.

Edition. Most chapters build on previous chapters, so you

Visual C# 2005 Express Edition is a fully functional subset

should plan on reading the material sequentially.

of Visual Studio 2005, suitable for creating and maintaining

Windows applications and libraries. It’s not a timed-bomb

Conventions and Features in This Book

edition, a demo, or a feature limited version; no, it’s a key

Microsoft initiative to reach more people and give them the

This book presents information using conventions designed

ability to have fun while creating cool software.

to make the information readable and easy to follow. Before

you start the book, read the following list, which explains

Who Is This Book For?

conventions you’ll see throughout the book and points out

helpful features in the book that you might want to use.

This book is for everybody: students, hobbyist programmers,

and also for people who always thought programming was a
Conventions
tough task. It’s for people who had ideas like: I wish I could

Each exercise is a series of tasks. Each task is presented as

build a tool to store all my recipes, I wish I could print them

a series of numbered steps (1, 2, and so on). Each exerand send them to my friends OR I wish I could build this cise is preceded by a procedural heading that lets you

cool card game that I have never found elsewhere OR I wish

know what you will accomplish in the exercise.

I could build this cool software to store my DVD and CD colNotes labeled “Tip” provide additional information or lection OR I wish I could build this software to help me work

alternative methods for completing a step successfully.

with matrices and plot graphics for my math class and many

more projects that one can think of!

Introduction

v

A02622299.indd v

A02622299.indd v

10/24/05 5:18:58 PM

10/24/05 5:18:58 PM

Notes labeled “Caution” alert you to information you

PC with a Pentium III-class processor, 600 MHz

need to check before continuing.

Recommended: 1 GHz

Text that you type or items you select or click appear in

128 MB RAM (256 MB or more recommended)

bold.

Video (800 x 600 or higher resolution) monitor with at

Menu commands, dialog box titles, and other user interleast 256 colors (1024 x 768 High Color 16-bit recomface elements appear with each word capitalized. mended)

A plus sign (+) between two key names means that you

CD-ROM or DVD-ROM drive

must press those keys at the same time. For example,

Microsoft Mouse or compatible pointing device

“Press Alt+Tab” means that you hold down the Alt key

while you press the Tab key.

You’ll also need administrator access to your computer

to configure SQL Server 2005 Express.

Other Features

N O T E

Shaded sidebars throughout the book provide more in
The CD-ROM packaged in the back
of this book contains the Visual

depth information about the content. The sidebars might

C# 2005 Express Edition software

contain background information, design tips, or features

needed to complete the exercises

in this book.

related to the information being discussed.

Each chapter ends with an In Summary… section that

Code Samples

briefly reviews what you learned in the current chapter

and previews what the next chapter will present.

The code samples for this book can be downloaded from the

book’s companion content page at the following address:

http://www.microsoft.com/mspress/companion/0-7356-2299-9/

System Requirements

You’ll use the code samples and starter solutions as you

perform the exercises in the book. By using the code samYou’ll need the following hardware and software to complete ples, you won’t waste time creating files that aren’t relevant the exercises in this book:

to the exercise. The files and the step-by-step instructions in

Microsoft Windows XP with Service Pack 2, Microsoft

the lessons also let you learn by doing, which is an easy and

Windows Server 2003 with Service Pack 1, or Microsoft

effective way to acquire and remember new skills. You’ll also

Windows 2000 with Service Pack 4

find the complete solutions if you want to verify your work

or if you simply want to look at it.

Microsoft Visual C# 2005 Express Edition

vi

Microsoft Visual C# 2005 Express Edition: Build a Program Now!

A02622299.indd vi

A02622299.indd vi

10/24/05 5:19:00 PM

10/24/05 5:19:00 PM

Installing the Code Samples

Follow these steps to install the code samples on your computer.

1 Download the code samples from
http://www.microsoft.com/mspress/companion/0-7356-2229-9/
. 2 After you download the code samples file, run the installer.

3 Follow the instructions that appear.

The code samples are installed to the following location on your computer: My Documents\Microsoft Press\VCS 2005 Express

Using the Code Samples

Each chapter in this book explains when and how to use any code samples for that chapter. When it’s time to use a code sample, the book will list the instructions for how to open the files. The chapters are built around scenarios that simulate real programming projects, so you can easily apply the skills you learn to your own work.

For those of you who like to know all the details, a list of the code sample projects appears on the next page. Almost all projects have solutions available for the practice exercises. The solutions for each project are included in the folder for each chapter and are labeled
Complete
.

Uninstalling the Code Samples

Follow these steps to remove the code samples from your computer.

1 In Control Panel, open
Add Or Remove Programs
.

From the list of Currently Installed Programs, select
Microsoft Visual C# 2005 Express Edition: Build
2
a Program Now!
and click
Remove
.

3 Follow the instructions that appear to remove the code samples.

Introduction

vii

A02622299.indd vii

A02622299.indd vii

10/24/05 5:19:00 PM

10/24/05 5:19:00 PM

Project Description

Chapter 1 & 2

No sample projects

Chapter 3

MyFirstConsoleApplication

Application that takes two numbers and adds them

together, then displays the sum in a console window.

MyFirstWindowsApplication

Same application but displays the result in a

message

box.

Chapter 4

MyOwnBrowser

Simple Web browser application that enables the

user to browse on the Internet.

Chapter 5

TestProject

Application that enables you to use the most important

features in Visual C# 2005 Express Edition.

Chapter 6

MyOwnBrowser

This is the continuation of the application from

Chapter 4. It is the Web browser to which you’ll add

menus, toolbars, a status and progress bar, and a

navigation window with autocomplete.

Chapter 7

Debugger

An application full of problems to help you learn how

to debug using features of Visual C# 2005

Express

Edition.

Chapter 8

CarTracker

An application enabling the user to track car ads from

the Internet using a SQL Server 2005 Express database

to store the information.

Chapter 9

WeatherTracker

An application that runs in the system-tray and has

a nice UI to display weather data collected by your

application from diverse Web services. A deployment

package is also created for the distribution of your

application.

viii

Microsoft Visual C# 2005 Express Edition: Build a Program Now!

A02622299.indd viii

A02622299.indd viii

10/24/05 5:19:01 PM

Other books

Puppet Pandemonium by Diane Roberts
El Gran Rey by Lloyd Alexander
City of Strangers by Ian Mackenzie
False Witness by Patricia Lambert
How to Avoid Sex by Revert, Matthew
Bo and Ms. Beanz by Jane Kirkland
A Bloodsmoor Romance by Joyce Carol Oates