SlideShare a Scribd company logo
Visit https://ebookultra.com to download the full version and
explore more ebooks
Microsoft Visual Basic 2008 Express Edition
Build a Program Now Pelland
_____ Click the link below to download _____
https://ebookultra.com/download/microsoft-visual-
basic-2008-express-edition-build-a-program-now-pelland/
Explore and download more ebooks at ebookultra.com
Here are some suggested products you might be interested in.
Click the link to download
Mastering Microsoft Visual Basic 2008 Evangelos Petroutsos
https://ebookultra.com/download/mastering-microsoft-visual-
basic-2008-evangelos-petroutsos/
Visual Basic 2008 Programmer s Reference Rod Stephens
https://ebookultra.com/download/visual-basic-2008-programmer-s-
reference-rod-stephens/
Visual Basic 2008 Recipes A Problem Solution Approach 1st
Edition Rakesh Rajan
https://ebookultra.com/download/visual-basic-2008-recipes-a-problem-
solution-approach-1st-edition-rakesh-rajan/
Programming Microsoft Visual Basic NET Version 2003
Francesco Balena
https://ebookultra.com/download/programming-microsoft-visual-basic-
net-version-2003-francesco-balena/
Programming with Microsoft Visual Basic 2012 6th Edition
Diane Zak
https://ebookultra.com/download/programming-with-microsoft-visual-
basic-2012-6th-edition-diane-zak/
Programming Microsoft SQL Server 2000 with Microsoft
Visual Basic NET 1st edition Edition Rick Dobson
https://ebookultra.com/download/programming-microsoft-sql-
server-2000-with-microsoft-visual-basic-net-1st-edition-edition-rick-
dobson/
An introduction to programming using Visual Basic 2008
with Visual Studio Expression edition DVD Schneider
https://ebookultra.com/download/an-introduction-to-programming-using-
visual-basic-2008-with-visual-studio-expression-edition-dvd-schneider/
Sams Teach Yourself Microsoft Visual Basic NET 2003 in 21
Days 2nd Edition Steven Holzner
https://ebookultra.com/download/sams-teach-yourself-microsoft-visual-
basic-net-2003-in-21-days-2nd-edition-steven-holzner/
Microsoft Visual Basic Programs to Accompany Programming
Logic and Design 3rd Edition Jo Ann Smith
https://ebookultra.com/download/microsoft-visual-basic-programs-to-
accompany-programming-logic-and-design-3rd-edition-jo-ann-smith/
Microsoft Visual Basic 2008 Express Edition Build a Program Now Pelland
Microsoft Visual Basic 2008 Express Edition Build a
Program Now Pelland Digital Instant Download
Author(s): Pelland, Patrice
ISBN(s): 9788120335042, 0735625417
Edition: PAP/CDR
File Details: PDF, 7.29 MB
Year: 2008
Language: english
Microsoft Visual Basic 2008 Express Edition Build a Program Now Pelland
PUBLISHED BY
Microsoft Press
A Division of Microsoft Corporation
One Microsoft Way
Redmond, Washington 98052-6399
Copyright Ā© 2008 by Microsoft Corporation
All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written
permission of the publisher.
Library of Congress Control Number: 2008920560
Printed and bound in the United States of America.
1 2 3 4 5 6 7 8 9 QWT 3 2 1 0 9 8
Distributed in Canada by H.B. Fenn and Company Ltd.
A CIP catalogue record for this book is available from the British Library.
Microsoft Press books are available through booksellers and distributors worldwide. For further information about international editions,
contact your local Microsoft Corporation office or contact Microsoft Press International directly at fax (425) 936-7329. Visit our Web site at
www.microsoft.com/mspress. Send comments to mspinput@microsoft.com.
Microsoft, Microsoft Press, DirectX, Excel, Expression, Expression Blend, IntelliSense, Internet Explorer, Jscript, MSDN, MSN, Outlook,
Silverlight, SQL Server, Visual Basic, Visual C#, Visual C++, Visual Studio, Visual Web Developer, Win32, Windows, Windows Live,
Windows Mobile, Windows Server, Windows Vista, Xbox and Xbox 360 are either registered trademarks or trademarks of Microsoft
Corporation in the United States and/or other countries. Other product and company names mentioned herein may be the trademarks of their
respective owners.
The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are
fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is
intended or should be inferred.
This book expresses the author’s views and opinions. The information contained in this book is provided without any express, statutory, or
implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will be held liable for any damages caused or
alleged to be caused either directly or indirectly by this book.
Acquisitions Editor: Ben Ryan
Developmental Editor: Sandra Haynes
Project Manager: John Pierce
Editorial Production: Happenstance Type O Rama
Technical Reviewer: Richard Triance
Body Part No. X14-55519
iii
Contents iii
Chapter 1
Introducing Microsoft Visual Basic 2008
Express Edition 1
What Is .NET? 2
What Is Visual Basic 2008? 4
Is Visual Basic 2008 an Object-Oriented
Programming Language? 4
What Is Visual Basic 2008 Express Edition? 9
What Kinds of Applications Can You Build with
Visual Basic 2008 Express Edition? 10
What Are the Key Features You Need to Know
About? 11
Chapter 2
Installing Visual Basic 2008 Express Edition 15
Preparing to Install Visual Basic 2008 Express Edition 16
Side-by-Side Installation 16
Prerelease Versions of Visual Basic 2008 Express Edition 17
Installing Visual Basic 2008 Express Edition 17
Chapter 3
Creating Your First Applications 25
Three Types of Applications: What Are the Differences? 26
Getting Started with the IDE 28
Building the Projects 31
Building a Console Application 31
Getting to Know Solution Explorer 32
Getting Help: Microsoft Visual Studio 2008
Express Edition Documentation 34
Coding Your Console Application 37
Customizing the IDE 39
Creating a Windows Application 41
Chapter 4
Creating Your Own Web Browser in Less
Than Five Minutes 47
What Is a Project? 48
What Is the Design Layout? 49
To Create a Simple Web Browser 50
Putting It All Together 56
Chapter 5
Using Rapid Application Development Tools
with Visual Basic 2008 59
Snapping and Aligning Controls Using Snap Lines 60
Using IntelliSense—Your New Best Friend! 62
Using IntelliSense as You Go 62
Using IntelliSense Filtering: Removing the ā€œUncommonā€ 63
Opening IntelliSense: Pressing Ctrl+Spacebar 64
Opening IntelliSense: Typing a Period or Left Parenthesis 64
Using IntelliSense Code Snippets: The Time-Saver 66
Invoking IntelliSense Code Snippets 67
Exploring Real-Time Error Detection and Correction 68
Oh, My...My Is Great 70
Contents
iv Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
Renaming 72
Why Should You Rename? 73
How to Use the Rename Feature 73
Exploring Common Windows Controls 75
What Happens When an Event Is Triggered? 78
Chapter 6
Modifying Your Web Browser 85
Opening Your Application 86
Interacting Through Dialog Boxes 93
Adding an About Dialog Box 93
Adding a Navigate Dialog Box 96
Having a Professional Look and Feel
at Your Fingertips 99
Adding a Tool Strip Container and Some Tools 99
Adding a Status Bar to Your Browser 101
Personalizing Your Application with Windows Icons 104
Redoing the Browser 112
Windows Presentation Foundation 112
WPF and XAML 113
Chapter 7
Fixing the Broken Blocks 125
Debugging an Application 126
Using a DLL in an Application 126
Using Breakpoints, Locals, Edit and Continue, and
Visualizers 128
Chapter 8
Managing the Data 141
What Is a Database? 142
What’s in a Database? 142
What Are Data Normalization and Data Integrity? 143
What Is Null? 145
What Are Primary Keys and Foreign Keys? 146
How Do You Interact with a Relational Database? 148
Using SQL Server 2005 Express Edition in
Visual Basic 2008 Express Edition 150
Creating a Database Using Visual Basic 2008
Express Edition 151
Creating Tables in Your Database 153
Creating Relationships Between the Tables 155
Entering Data in SQL Server Tables Using
Visual Studio 159
What Are ADO.NET, Data Binding, and LINQ? 163
Developing the CarTracker Application 165
Using the Component Tray 172
How Do I Get More Meaningful Information
on My Form? 173
Using LINQ 182
Chapter 9
Building Your Own Weather Tracker Application 187
Exploring the Features of the Weather Tracker
Application 188
Creating the Application User Interface 189
Adding Notification Area Capabilities 191
Adding the Splash Screen and About Dialog Box 199
Adding the Options Dialog Box 202
Using the MSN Weather Web Service 204
Connecting to MSN Weather Web Services 206
Setting User and Application Preferences 210
Working in the Background 211
Completing the Core Weather Tracker Functionality 219
Testing Weather Tracker 225
Working with the Options Dialog Box 226
Testing Weather Tracker Options 229
And Now, Just ClickOnce 229
Glossary 235
Index 237
v
Introduction
Microsoft Visual Basic 2008 Express Edition (and the
other Visual Studio 2008 Express Edition products) is, in my
opinion, one of the best and most intelligent ideas to come
from the Developer Division at Microsoft. I’m applauding
and cheering for the people who had this brilliant idea
because I believe there is a real need and demand for a
world-class, powerful product for hobbyist programmers,
students, and professional developers. And Visual Basic
2008 Express Edition provides all of that and more.
Visual Basic 2008 Express Edition is a fully functional
subset of Visual Studio 2008, suitable for creating and
maintaining Windows applications and libraries. It’s not
a timed-bomb edition, a demo, or a feature-limited
version—no, it’s a key Microsoft initiative to reach more
people and give them the ability to have fun while creating
cool software.
Who Is This Book For?
This book is for everybody: students, hobbyist pro-
grammers, and people who always thought programming
was a tough task. It’s for people who have ideas like ā€œI wish
I could build a tool to store all my recipes and then print
them and send them to my friends,ā€ ā€œI wish I could build
this cool card game that I have never found elsewhere,ā€ ā€œI
wish I could build this cool software to store my DVD and
CD collection,ā€ ā€œI wish I could build this software to help me
work with matrices and plot graphics for my math class,ā€
and many more projects that you can imagine!
This book is for people who have ideas but don’t know
how to bring them to reality. And it’s a good introduction
to the art and science of developing software.
How This Book Is Organized
This book consists of nine chapters, each covering a
particular feature or technology about Visual Basic 2008
Express Edition. Most chapters build on previous chapters,
so you should plan on reading the material sequentially.
Conventions and Features in This Book
This book presents information using conventions
designed to make the information readable and easy to
follow. Before you start the book, read the following list,
which explains conventions you’ll see throughout the book
and points out helpful features in the book that you might
want to use:
Each exercise is a series of tasks. Each task is presented
ā– 
as a series of numbered steps (step 1, 2, and so on).
Each exercise is preceded by a procedural heading that
lets you know what you will accomplish in the exercise.
Introduction v
vi Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
Boxes labeled
ā–  TIP, NOTE, MORE INFO, and so on, pro-
vide additional information or alternative methods for
completing a step successfully.
Boxes labeled
ā–  CAUTION alert you to information you
need to verify before continuing.
Text that you type appears in bold.
ā– 
Menu commands, dialog box titles, and other user
ā– 
interface elements appear with each word capitalized,
such as in ā€œclick Save As.ā€
A plus sign (+) between two key names means that you
ā– 
must press those keys at the same time. For example,
ā€œPress Alt+Tabā€ means that you hold down the Alt key
while you press the Tab key.
Code listings appear in a monospaced font in this book.
ā– 
Sidebars throughout the book provide more in-depth
ā– 
information about the content. The sidebars might con-
tain background information, design tips, or features
related to the information being discussed.
Each chapter ends with an ā€œIn Summaryā€¦ā€ section that
ā– 
briefly reviews what you learned in the current chapter
and previews what the next chapter will present.
System Requirements
You’ll need the following hardware and software to
complete the exercises in this book:
Windows Vista, Microsoft Windows XP with Service
ā– 
Pack 2, or Microsoft Windows Server 2003 with
Service Pack 2
Visual Basic 2008 Express Edition
ā– 
1 GHz 32-bit (x86) processor
ā– 
1 GB MB RAM (512 MB minimum)
ā– 
40 GB hard drive with at least 15 GB of available space
ā– 
Support for Super VGA graphics (for support for
ā– 
DirectX 9 graphics, see the recommended requirements
at www.microsoft.com/windows/products/windowsvista/
editions/systemrequirements.mspx)
CD-ROM or DVD-ROM drive
ā– 
Microsoft mouse or compatible pointing device
ā– 
You’ll also need administrator access to your computer
to configure SQL Server 2005 Express Edition.
Code Samples
You can download the code samples for the examples
in this book from the book’s companion content page at
the following address: http://www.microsoft.com/mspress/
companion/9780735625419/. You’ll use the code samples
and starter solutions as you perform the exercises in the
book. By using the code samples, you won’t waste time cre-
ating files that aren’t relevant to the exercise. The files and
step-by-step instructions also let you learn by doing, which
is an effective way to acquire and remember new skills.
You’ll also find the complete solutions if you want to verify
your work or simply want to look at them.
N O T E
The companion DVD contains the Visual Basic 2008 Express Edition soft-
ware needed to complete the exercises in this book. The DVD also includes
the other Visual Studio 2008 Express Editions—for Visual C#, Visual C++,
and Web development. You can install any of the Express Edition products
included on the DVD. See Chapter 2, ā€œInstalling Visual Basic 2008 Express
Edition,ā€ for detailed installation instructions.
vii
Introduction vii
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/9780735625419/.
2. After you download the code samples file, run the
installer.
3. Follow the instructions that appear.
The code samples are installed in the Documents
Microsoft PressVB 2008 Express folder on your
computer.
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 in the following table.
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.ā€
Project Description
Chapters 1 and 2 No sample projects.
Chapter 3
MyFirstConsoleApplication
MyFirstWindowsApplication
Application that takes two numbers, adds them together, and then displays the sum in a
console window.
Same application as MyFirstConsoleApplication, but this one 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 teaches you to use the most important features in Visual Basic 2008
Express Edition.
Chapter 6
MyOwnBrowser
This is the same application you developed in Chapter 4, enhanced with additional
features. You’ll add menus, toolbars, status and progress bars, and a navigation win-
dow with autocomplete. You’ll also build a simple browser using Windows Presentation
Foundation (WPF).
viii Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
Uninstalling the Code Samples
Follow these steps to remove the code samples from
your computer.
ON WINDOWS VISTA
1. In Control Panel, click Programs.
2. Under Programs and Features, click Uninstall a Program.
3. In the list of programs, select Microsoft Visual Basic
2008 Express Edition: Build a Program Now!, and then
click Uninstall.
4. Follow the instructions on the screen to remove the
code samples.
ON WINDOWS XP
1. In Control Panel, open Add or Remove Programs.
2. From the Currently Installed Programs list, select Micro-
soft Visual Basic 2008 Express Edition: Build a Program
Now!, and click Remove.
3. Follow the instructions on the screen to remove the
code samples.
Prerelease Software
This book was reviewed and tested against the Novem-
ber 2007 release candidate for Visual Studio 2008. This book
is expected to be fully compatible with the final release of
Visual Studio 2008. If there are any changes or corrections
for this book, they’ll be collected and added to a Microsoft
Knowledge Base article. See the ā€œSupport for This Bookā€
section later in this introduction for more information.
Technology Updates
As technologies related to this book are updated, links
to additional information will be added to the Microsoft
Project Description
Chapter 7
Debugger
An application full of problems to help you learn how to debug an application by using
features of Visual Basic 2008 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. You’ll also be introduced to Language
Integrated Query (LINQ).
Chapter 9
Weather Tracker
An application that runs in the system tray and has a nice user interface to display
weather data collected by your application from the MSN Weather service. You’ll also
create a deployment package for the distribution of your application.
ix
Introduction ix
Press Technology Updates Web page (http://www.micro-
soft.com/mspress/updates/). Visit this page periodically for
updates on Visual Studio 2008 and other technologies.
Support for This Book
Every effort has been made to ensure the accuracy
of this book and the companion content. As corrections
or changes are collected, they’ll be added to a Microsoft
Knowledge Base article. To view the list of known correc-
tions for this book, visit http://support.microsoft.com/, and
in the Search box, enter the book title.
Microsoft Press provides support for books and com-
panion content at http://www.microsoft.com/learning/
support/books/.
Questions and Comments
If you have comments, questions, or ideas regarding
the book or the companion content or have questions that
are not answered by visiting the sites listed earlier, please
send them to Microsoft Press via e-mail to mspinput@
microsoft.com.
Or you can send them via postal mail to the following
address:
Microsoft Press
Attn: Visual Basic 2008 Express Edition: Build a Program
Now! Editor
One Microsoft Way
Redmond, WA 98052-6399
Please note that Microsoft offers no software product
support through these addresses.
About the Author
Patrice Pelland is a development manager at Microsoft
working in the Online Services Group. He has a passion for
Web 2.0 technologies, Silverlight, WCF, and ASP.NET. For
the past four years, he has been working, teaching, evange-
lizing, and talking about these technologies to everyone.
For the past 14 years, he has been working in software
development in various roles: developer, project lead,
manager and mentor, and software engineer in QA orga-
nizations. He has vast experience spanning multiple tech-
nologies and fields, including Web development, developer
tools, fiber optics telecommunication, aviation, and coffee
and dairy companies. He also spent three years teaching
computer science and software development at a college in
Canada.
When not developing great tools for developers and
helping customers throughout the world, he enjoys spend-
ing time with his family and friends, playing games on Xbox
360 and his PC, reading books, reading about cars, playing
hockey, watching NHL hockey and NFL football, and having
great dinners with good food and fine drinks with friends
and family. He resides with his family in Sammamish, Wash-
ington.
Dedication
This book is dedicated to my family. My wife, Hélène,
is my strength; because of her love and her respect, I am a
better human being. She’s beautiful—my idol, my inspira-
tion, my sunshine, my best friend, my love, and an awe-
some mother! Mon amour, thanks for being who you are
x Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
and for being there for me. I love you! Thanks to her for
letting me repeat this crazy adventure of writing a book.
Thanks
First of all, thanks to my parents. Mom and Dad,
you gave me all the chances to be what I am in life and you
gave me the values to be the man I am. Thanks, and I
love you!
A book is a huge adventure in somebody’s life (imag-
ine two ☺), and it would not be possible without the help
of many people. I’ve always read the ā€œthank youā€ sections
in other people’s books, and I was always amazed at how
many people are needed to make a book what it is. Now I
really understand why!
Although writing a book is tough—real tough—it’s
really satisfying at the same time. During the writing pro-
cess, you sometimes have doubts, and I had my share of
them, especially those nights at 3 a.m. when all other souls
in the house were asleep, even my dog; when I was in front
of my laptop with an exception and a white page in Micro-
soft Word. I can’t remember how many times I said to my
friends, ā€œNo, I won’t be able to be there. I need to work on
my book.ā€ But it’s an awesome experience to write a book;
everybody who has the chance should take the challenge!
That said, I first need to thank my lovely family for
letting me do this to them again. My kids (Laura, 13,
and Antoine, 11) and my wife, Hélène, were so great and
patient. This time they said, ā€œYou’re writing another book!
Oh, no…we’ll see you after Thanksgiving.ā€ But at the same
time, they were respecting the space I needed and the time
alone! You guys are great, and I love you!
I have to thank all the people at Microsoft Learning and
the publishing team. I would especially like to thank Ben
Ryan for offering me the chance to work with him again;
Sandra for her constant motivation, help, and suggestions
and also for helping me through all the hurdles of writing a
book; and all the folks on the publishing team for all their
help getting the job done and producing a real, tangible
product. You guys have my respect for working day in, day
out in the crazy world of publishing.
I would also like to thank all the people in the Visual
Basic, C#, Windows Forms, MSDN, and setup teams who
helped me by answering all my questions in a dynamic and
constantly changing product life cycle. I would like to thank
more specifically Dan Fernandez, Joe Binder, Brian Keller,
Brian Johnson, Hong Gao, Jay Roxe, Kavitha Radhakrishnan,
Kent Sharkey, Lisa Feigenbaum, Shamez Rajan, Steve Lasker,
Aaron Stebner, and Habib Heydarian.
Thanks also to my colleagues at MSN for always giv-
ing me good words of encouragement and to my friends
Pascal, Simon, Nicolas, John, and Patrice for reviewing the
samples and some chapters.
Thanks to my good friends here in the Puget Sound
area for the kind words of encouragement and to my fam-
ily and friends in Canada for understanding why I’m not
calling or giving any news. Sorry, Mom and Dad!
Thanks to everybody I might have forgotten!
Patrice Pelland
November 2007
Sammamish, WA
1 1
What Is .NET?, 2
What Is Visual Basic
2008?, 4
Is Visual Basic 2008
an Object-Oriented
Programming
Language?, 4
What Is Visual Basic 2008
Express Edition?, 9
Chapter 1
Introducing Microsoft
Visual Basic 2008
Express Edition
Maybe you’ve decided to try programming and find yourself with this
book. If that’s the case, you’ve come to the right place. This book is all about
introducing you to the art, science, and joys of creating software for Micro-
soft Windows—yes, the same Microsoft Windows you probably use every
day. Throughout the book, I’ll show you how to build applications that are
similar to many of the applications you use on a regular basis, such as your
Internet browser, your word processor, your e-mail software, and your per-
sonal finance application. You’re probably wondering how you could pos-
sibly do this with no programming experience. Don’t worry. By the time you
finish this book, you’ll be a believer. We’ll have a blast, and because you’ll
actually be building applications as you follow along with each exercise,
you’ll see for yourself just how easy it can be.
2 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
What is this .NET thing everybody is talking about? Maybe you’ve seen the term some-
where online or have come across it in the jobs section of your Sunday newspaper. A good
analogy is that .NET—also called the .NET Framework—is to a software developer what tools
and manuals are to an auto mechanic.
Here is a formal definition of the .NET Framework:
The .NET Framework is a platform with which you can develop software applications
and libraries called managed applications; it provides you with the compiler and tools
you need to build, debug, and execute managed applications.
For our purposes, you could say that .NET is the platform that gives you everything you
need to develop and run managed applications that run on Windows.
We say that applications are managed because their execution is managed by the .NET
Framework. In fact, the .NET Framework manages the execution by providing a controlled
runtime environment that offers a wide variety of services, such as loading your applications,
managing memory, and monitoring and maintaining security and integrity while the applica-
tion runs. Before .NET (and Java), applications were unmanaged because they were not
executed by a controlled runtime environment. No other component of the operating
system provides the services .NET offers. The applications had to manage their own services,
which sometimes led to erroneous code, security holes, and data corruption. Because of
these problems, applications were tough to maintain and debug.
The .NET Framework provides you with a wide variety of tools, such as compilers, debug-
gers, programming languages, an execution engine (named the Common Language Runtime
[CLR]), developer tools, and a large number of predefined ā€œbuilding blockā€ libraries. These
libraries are named Framework Class Libraries (FCLs). You can think of each .NET component
as a building block in a house and each version of .NET as an insulation layer in the walls of
a house. Figure 1-1 illustrates how many versions of .NET are on the market, as well as what
components have been added and in which version they belong.
What Is .NET?
N O T E
Throughout this book, I’ll use
the terms framework and .NET
Framework synonymously.
Chapter 1: Introducing Microsoft Visual Basic 2008 Express Edition 3
NET 2.
0
NET 3.0
NET 3.5
WCF
WF
WPF
CardSpace
LINQ
AJAX
REST
CLR
WinForms
Web Services
ASP.NET
Visual Studio 2008
Figure 1-1
Additive versions of the .NET Framework
Some of these building blocks ship with the Windows Vista operating system. Two
popular ones are Windows Presentation Foundation (WPF) and Windows Communication
Foundation (WCF). WPF is a library that helps you build richer user interfaces and Windows
Vista–like applications for Windows. WCF, as its name implies, is a library that helps two
applications talk to each other using messages. To understand the relationship between
.NET 3.0 and .NET 3.5, remember that .NET 3.0 comes with Windows Vista and .NET 3.5
comes with Visual Studio 2008. Language Integrated Query (LINQ), which simplifies writing
code that manipulates data from various data sources (SQL Server databases, XML files, and
so on), is one of the features in .NET 3.5 that we’ll cover in this book.
N O T E
What do the other abbreviations
and names in Figure 1-1 mean?
WF is the Windows Workflow
Foundation, another building
block that developers can use to
help automate business processes
through programs. CardSpace is
a technology related to manag-
ing online identities—something
like using a credit card. AJAX
(Asynchronous JavaScript
And XML) is used to develop
Web applications, and REST
(Representational State Transfer)
is a programming architecture
used for transferring data on
the Web.
4 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
I won’t put you to sleep with all the definitions for each building block. We’re going to
use or talk about most of them in our projects in this book, and I’ll introduce the blocks
when appropriate. Just consider Figure 1-1 and return to it when you need to do so.
Two notes about this figure are worth mentioning.
First, look at the blue component on top of the concentric circles. Microsoft Visual Studio
2008 is not part of the .NET Framework, but it touches the .NET Framework at all levels. With
Visual Studio 2008, you can develop applications that take advantage of all the components
of the .NET Framework.
Second, notice that the CLR, among other components, is at the center of the circles. The
CLR is a crucial part of the foundation because it’s the engine that loads and manages the
execution of source code.
Visual Basic 2008 is one of the programming languages that target the .NET Framework.
Like any spoken or written language, Visual Basic has syntax rules and a series of valid words
you can use to create your applications. Visual Basic is a popular choice for beginners because
some people find the syntax simpler than the syntax of many other programming languages.
If you have used an older version of Visual Basic (such as Visual Basic 4.0, 5.0, or 6.0), you’ll
find some familiar constructs and a familiar user interface (UI) in Visual Basic 2008.
Visual Basic 2008 is a fully fledged object-oriented programming language. Let’s talk
about what this means.
I M P O R TA N T
It’s not necessary to have
Visual Studio to develop .NET
applications, but using it offers
many advantages, as you’ll see in
this book.
I M P O R TA N T
The CLR hasn’t changed in
Windows Vista and Visual
Studio 2008; the CLR that is run-
ning on all operating systems is
.NET 2.0.
What Is Visual Basic 2008?
Is Visual Basic 2008 an Object-Oriented
Programming Language?
Chapter 1: Introducing Microsoft Visual Basic 2008 Express Edition 5
Object-oriented programming (OOP) is a programming style (or programming para-
digm). There are other programming paradigms, such as functional or procedural program-
ming. Languages such as C, Fortran, Pascal, and previous versions of Visual Basic all use
functional or procedural programming paradigms. These paradigms focus more on the
actions, while OOP focuses more on the data itself.
Applications that use the OOP paradigm are developed using OOP languages (OOPLs).
The first OOPLs were introduced in the late 1960s, but they really became popular in the late
1970s. They are widely used today because most people agree that they’re easy to learn, use,
debug, and maintain. For instance, OOPLs easily represent real-world objects. Visual Basic
2008 is an OOPL as are C#, C++, Java, Smalltalk, Lisp, and others.
Programmers use OOP to write programs that represent the decomposition of real-
world problems into modules. Those modules represent real-world objects and are known as
classes or types. You can think of an OOP program as a collection of objects interacting with
each other. Using OOP, a programmer defines new types to represent real-world objects,
such as a plane, a person, a customer, a dog, or a car. Those types or classes have what are
known as constructors, which developers use to create objects or instances. An object in a
program is a unit that represents one instance of a real-world object. It’s a self-contained
unit because it includes all the data and functionality associated with that object. This means
each object created in an application contains all the information that characterizes it (data
members or fields) and all the actions (methods) that can access or modify that information.
Here is a simple example in Visual Basic 2008 that defines a Person class:
1 Public Class Person
2 ā€˜Data members
3 Private Name As String
4 Private Address As String
5 Private City As String
6 Private State As String
7 Private ZIP As String
8 Private Country As String
9
10 ā€˜Methods
11 Overridable Sub Display()
12 Console.WriteLine(Name)
13 Console.WriteLine(Address)
14 Console.WriteLine(City)
M O R E I N F O
With C++ you can develop proce-
dural applications, pure object-
oriented applications, or a mix
of both.
6 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
15 Console.WriteLine(State)
16 Console.WriteLine(ZIP)
17 Console.WriteLine(Country)
18 End Sub
19 End Class
This class includes private data members and a Display method to print the object’s
content to the console. The Sub method is by default public. The Overridable keyword means
that a new class derived from this class will be able to write its own implementation of the
Display method.
Let’s use a different example to go over these concepts some more. My dog, Chopin,
is an instance of the class Dog, and the class Dog is a subclass of the Animal class. Because
Chopin is a dog, he has some behaviors and data that are proper for a dog. But because a
dog is also an animal, Chopin also inherits some data and behaviors from the Animal class.
This means that the instance Chopin of the class Dog has data members that character-
ize him and methods that I can call on that little furry ball. For example, here is the instance
information for the Chopin object:
Data
Breed
ā–  He’s a Maltese.
Gender
ā–  He’s male.
Weight
ā–  His weight is 5.5 pounds (2.5 kilograms).
Color
ā–  He’s white.
Name
ā–  His name is Chopin Chabispel.
Age
ā–  He’s three years old.
Actions
He speaks (barks).
ā– 
He eats.
ā– 
He moves.
ā– 
He sleeps.
ā– 
M O R E I N F O
In the example of the Person
class, you would need to imple-
ment properties to access or
modify the Private fields from
outside the class. These types of
fields hide data in your class.
Chapter 1: Introducing Microsoft Visual Basic 2008 Express Edition 7
All these data items (breed, gender, weight, color, name, and age) and actions (speak,
eat, move, and sleep) characterize him, but they can also characterize any other dog, such as
my neighbor’s dog, Molly. And if you think about it, those items can characterize any animal.
This means that the class Dog inherits data members and methods from the class Animal.
Let’s say you want to develop an application for a veterinary clinic. To cover the cats
who come to your clinic, all you must do is create a Cat class that also inherits from the class
Animal. Then each class (Cat and Dog) could override functionality in the Animal class as
needed. For instance, for the Cat class the Speak method would be meows instead of barks.
This means that those Speak methods for Cat and Dog are specializations of the regular
animal Speak method.
Let’s look at the Person class example again. This time, I’ll also show an Employee class
that derives from the Person class. The Employee class derives from the Person class by using
the keyword Inherits followed by the Person element. The keyword Overrides changes the
implementation of the Display method.
20 Public Class Employee
21 Inherits Person
22
23 Public Level As Integer
24 Public Salary As Integer
25
26 Overrides Sub Display()
27 Console.WriteLine(Name + ā€œ is at level ā€œ + Level.ToString() +
ā€œ and has a salary of : ā€œ + Salary.ToString() + ā€œ$ā€)
28 Console.WriteLine(ā€œHis address is:ā€)
29 Console.WriteLine(Address)
30 Console.WriteLine(City + ā€œ,ā€ + State + ā€œ ā€œ + ZIP)
31 Console.WriteLine(Country)
32 End Sub
33 End Class
In this case, the Employee class inherits from the Person class and therefore gets all the
data fields from that base class. The Employee class doesn’t have to redefine any of the fields
in its definition because it gets them automatically from Person. So, for the Employee class,
you must specify only what is different from an instance of the Person class. For example, an
instance of the Employee class would have Level and Salary, whereas none of the instances
T I P
In this book, you’ll notice that
some code listings include line
numbers. If a line does not
include a number, it indicates
that the code is a continuation
from the previous line. Some
code lines can get rather long and
must be wrapped to be displayed
on the printed page. If you need
to type the code in Visual Basic,
be sure to put continued lines on
a single line.
8 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
of the Person class would. The Display method for Employee could thus add level and salary
information to the displayed message when it is called.
This was just a brief introduction to OOP and some of its concepts. Visual Basic 2008
supports all of these concepts and many more. Throughout this book you’ll see more OOP
concepts, and when you do, I’ll highlight them in a ā€œreader aidā€ information box, as shown in
the left margin.
Here’s the complete listing used in this section with the addition of the Customer class:
34 Imports System
35
36 Public Class Person
37 ā€˜Data members
38 Public Name As String
39 Public Address As String
40 Public City As String
41 Public State As String
42 Public ZIP As String
43 Public Country As String
44
45 ā€˜ Methods
46 Overridable Sub Display()
47 Console.WriteLine(Name)
48 Console.WriteLine(Address)
49 Console.WriteLine(City)
50 Console.WriteLine(State)
51 Console.WriteLine(ZIP)
52 Console.WriteLine(Country)
53 End Sub
54 End Class
55
56 Public Class Customer
57 Inherits Person
58
59 Public ID As Integer
60 Public IsPartner As Boolean
61
62 Overrides Sub Display()
63 Dim partnerMessage As String
64
65 If IsPartner Then
66 partnerMessage = ā€œ is a partnerā€
N O T E
In .NET, all classes ultimately
derive from the Object class, even
when it is not specified.
Chapter 1: Introducing Microsoft Visual Basic 2008 Express Edition 9
67 Else
68 partnerMessage = ā€œ is not a partnerā€
69 End If
70
71 Console.WriteLine(ā€œCustomer ID: ā€œ + ID.ToString())
72 Console.WriteLine(Name + partnerMessage)
73 Console.WriteLine(Address)
74 Console.WriteLine(City + ā€œ,ā€ + State + ā€œ ā€œ + ZIP)
75 Console.WriteLine(Country)
76 End Sub
77 End Class
78
79 Public Class Employee
80 Inherits Person
81
82 Public Level As Integer
83 Public Salary As Integer
84
85 Overrides Sub Display()
86 Console.WriteLine(Name + ā€œ is at level ā€œ + Level.ToString() + ā€œ and
has a salary of : ā€œ + Salary.ToString() + ā€œ$ā€)
87 Console.WriteLine(ā€œHis address is:ā€)
88 Console.WriteLine(Address)
89 Console.WriteLine(City + ā€œ,ā€ + State + ā€œ ā€œ + ZIP)
90 Console.WriteLine(Country)
91 End Sub
92 End Class
This is a simple case, but it illustrates some of the basic concepts of OOP.
What Is Visual Basic 2008 Express Edition?
Visual Basic 2008 Express Edition is the tool we will use throughout this book to develop
applications that run on Windows. The Express editions of Visual Studio 2008 were designed
10 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
to focus on productivity. As with the high-end versions of Visual Studio 2008, the Express
editions are also what we call rapid application development (RAD) tools because their phi-
losophy is geared toward productivity. The Express editions of Visual Studio are easy to use,
easy to learn, and streamlined because although they contain mostly the same components,
they lack the full breadth of features found in the higher-end versions of Visual Studio. Most
features and components in the Express editions were simplified to make the learning curve
less steep and to fit the needs of the nonprofessional developer.
The Visual Studio 2008 Express editions were designed with beginner programmers in
mind—people like you who are curious about programming and who are looking for an
easy way to build Windows applications while learning how to program. Visual Basic 2008
Express Edition is the ideal tool to use to rapidly develop applications for topics you really
love or for hobbies you enjoy. You can also use it to help ease your day-to-day job or school
tasks. Most important, you can have fun with the tool while you’re learning to program.
What Kinds of Applications Can You Build with
Visual Basic 2008 Express Edition?
With this version of Visual Studio 2008, you’ll be able to create the following types of
applications:
Windows applications
ā–  These are applications that have a graphical interface with
buttons, windows, menus, toolbars, and so on, as in Microsoft Word or Windows Internet
Explorer. With this book you’ll be able to take full advantage of WPF, which lets you build
applications that create a rich user experience while exploiting all the power of your com-
puter. You can also build applications that look like Windows Vista–based applications.
Console applications
ā–  These are applications that have no graphical interface and that
simply use text to communicate with the user. (Typically, these applications run in a com-
mand window or DOS window.)
Reusable components or class libraries
ā–  These are groups of tools created to help
build other applications.
What you won’t be able to build are Web sites and Web services. To create any type of
Web application, you will need to get Microsoft Visual Web Developer 2008 Express Edition.
N O T E
We will look into the details
of what types of applications
fall into these categories in
Chapter 3, ā€œCreating Your First
Applications.ā€
Chapter 1: Introducing Microsoft Visual Basic 2008 Express Edition 11
What Are the Key Features You Need to Know About?
The following list, although not complete, provides the essential features of Visual Basic
2008 Express Edition. At this point, don’t worry if you don’t understand every feature listed.
I’m presenting the features in the list because you’ll come across all of them in some way in
the fun sample applications you will be creating as you read this book.
Most of the features listed here emphasize the RAD philosophy. Although the idea is to
give you an overview of the interesting features that can make your life easier, the names
of the features alone are not sufficient to understand what they mean. I’ve included a brief
description giving you the essentials and explaining how they will help you develop applica-
tions.
Built-in Starter Kits
ā–  The Starter Kits are fully developed applications with best practices
and examples to follow. These applications will give you another example on which to
base your learning. They will be a good complement to what we are doing in this book.
You can find them at http://msdn2.microsoft.com/en-us/vbasic/ms789080.aspx.
Beginner’s targeted documentation and tutorials
ā–  These are a fast and easy way to
get information. They also provide samples.
IntelliSense
ā–  This feature provides real-time syntax suggestions and even finishes your
typing for you. In Visual Studio 2008, IntelliSense, as you will see, is everywhere (it’s now
called IntelliSense Everywhere), and it provides a more complete and contextual set of
suggestions.
Code snippets
ā–  Snippets provide code for more than 200 programming tasks to help
you complete many common tasks automatically. In addition, code snippets show the
recommended way of performing a task. They are directly integrated into the develop-
ment environment, and they are extensible; that is, anybody can extend the existing snip-
pets or provide new ones. Over time Microsoft will continue to supply new code snippets,
and members of online communities will contribute their snippets as well. Code snippet
extensibility seems to be a really nice feature that will help people share useful features in
online communities.
My
ā–  construct This new Visual Basic feature provides simple access to popular .NET
Framework classes and common tasks. With it you can perform tasks without knowing
12 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
all the framework internals. These tasks are nicely wrapped and provide you with an easy
and clean way of getting things done. Although similar to code snippets, the My con-
struct elements have their source code hidden and wrapped in one line of code.
Data-enabled applications
ā–  With these applications you can connect to Microsoft SQL
Server 2005 Express Edition and add databases and code to access the data in your appli-
cations. In addition, a new editor has been added to help you develop applications that
use data. As mentioned earlier, LINQ is one of the big new features of .NET 3.5 included
with Visual Studio 2008, and you’ll see how to use it in Chapter 8, ā€œManaging the Data.ā€
Windows Forms Designer and WPF Designer
ā–  With these new tools, you can easily
design your Windows application using either Windows Forms or WPF, including features
such as snap lines, which make sure your controls are aligned in your form, and autocor-
rect, which gives you real-time compiler feedback. You won’t have to compile your code
to know whether you have errors; Visual Basic 2008 will show them to you as you type
and even give you potential fixes.
XAML Editor
ā–  The XAML Editor lets you edit Extensible Application Markup Language
(XAML), which was introduced with .NET 3.0. This new markup language is used exten-
sively in WPF and Windows Workflow (WF) to describe user interface elements in WPF
and process logic in WF. (WF is beyond the scope of this book.)
XML Web services
ā–  Visual Basic 2008 provides easy-to-use tools and wizards that will
help you connect to published XML-based Web services and will help you utilize their
functionality.
New Windows Forms controls
ā–  These comprise an impressive list of controls—a
greater selection than in any previous version of Visual Basic. They will help you create
user interfaces that have a professional look and feel.
Smart Tags
ā–  Most Windows Forms controls that come with the product include Smart
Tags. As in many applications of the 2007 Microsoft Office system, a Smart Tag is rep-
resented by a little black triangle, or an icon and a little black triangle, attached to a
control. A Smart Tag gives you access to the most common actions you can perform
on a control.
M O R E I N F O
XAML is also used in Silverlight
for Web applications, but this is
beyond the scope of this book.
Chapter 1: Introducing Microsoft Visual Basic 2008 Express Edition 13
ClickOnce deployment
ā–  With this feature you can easily publish your applications on
the Internet, on a local area network (LAN), on a network share, or on a CD. It also simpli-
fies publishing updates. In this new edition of Visual Studio, you can now use a wizard to
handle the Windows Vista User Account Control (UAC) so that your application runs in
the lowest user security context it needs. Usually you want to aim your software develop-
ment on Windows Vista at regular users. This has the effect of reassuring users that your
application won’t perform unsafe operations without their knowledge.
Edit and Continue
ā–  While you are debugging your application, the Edit and Continue
feature lets you modify the code, move back and forth in the debugger, re-execute code,
add functionality, or fix bugs on the fly without stopping program execution.
Debugger visualizers
ā–  While you are debugging your application, the visualizers give
you an easy way to get readable representations of your application data. They give you
a human-readable representation of the stored data, even for more complex types found
in ADO.NET or XML.
Community Access and Start pages
ā–  With these features, you can access additional
information from online communities and from different sources of online help, including
diverse RSS feeds. (RSS can stand for Rich Site Summary or Really Simple Syndication and
is a family of XML file formats; it is widely used by the weblog community and news
Web sites.)
Simplified development environment
ā–  Everything in the development environment
was created so that you can easily access key functionality, tools, and objects.
As you can see, Visual Basic 2008 Express Edition includes many nice features to help
new programmers develop applications in a fast and fun way. These features will provide
guidance even when you’re not necessarily sure what syntax or components to use and will
greatly expedite learning the product.
14 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
In Summary…
You now know that .NET is a framework composed of compilers, tools, languages,
debuggers, and an execution engine. The CLR is that execution engine, and it is responsible
for loading and executing managed applications. In essence, .NET is like a house with the
CLR as the foundation and all other services built on top of it. You also learned that the CLR
didn’t change with Windows Vista and Visual Studio 2008, but a lot of new building blocks
have been added so you can take advantage of features provided by Windows Vista and
make developing applications easier.
In addition, you learned that Visual Basic 2008 is an object-oriented programming
language that has a simpler syntax than most modern programming languages. You also
started to learn what object-oriented programming is and the basics of OOP in Visual Basic
2008.
This chapter gave you the opportunity to hear about the most important features of
Visual Basic 2008 Express Edition. In the next chapter, you’ll learn how to install Visual
Basic 2008 Express Edition.
2 15
Preparing to Install
Visual Basic 2008 Express
Edition, 16
Installing Visual Basic
2008 Express Edition, 17
Chapter 2
Installing Visual Basic
2008 Express Edition
In this chapter, you’ll install Microsoft Visual Basic 2008 Express Edition
and start getting to know what components are included with it. I’ll guide
you through all the steps of this installation so that you will be ready to start
building applications using Visual Basic 2008 Express Edition right away.
In addition, I will talk about some common installation scenarios, give you
some tips for installing the product, and cover what to do if the unexpected
happens.
The installation process is easy and straightforward, following in the spirit
of the Microsoft Visual Studio Express editions.
16 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
You have a couple of options for installing Visual Basic 2008, particularly if you’ve had
previous versions installed or if you installed an early (prerelease) version of the product.
Before you start the installation, make sure your computer meets the software and hard-
ware recommendations. Review the introduction of this book for all the necessary informa-
tion. You will also want to be sure that your computer has the latest updates from Windows
Updates (http://windowsupdate.microsoft.com) and Microsoft Updates (http://update.
microsoft.com). Installing the latest updates will ensure that your computer has all the lat-
est security updates along with some installation prerequisites before starting the product
installation.
If you have an antivirus or antispyware application installed and running, it might prompt
you to choose to allow certain setup tasks to proceed. For instance, with the latest Microsoft
Windows Defender (http://www.microsoft.com/athome/security/spyware/software/default.
mspx), I was asked two times to allow certain tasks to proceed, and a few other times the
antispyware product recognized the source and simply mentioned it and continued. If you are
using a different antispyware application, your experience might vary slightly, but it will bear
some similarities to this process. These antivirus and antispyware products are giving you an
opportunity to confirm the origin of the product you’re about to install. When you’re sure it’s
from Microsoft, let the setup application continue its job by choosing to allow the action.
During the installation, if something goes wrong, you’re probably not the only person
to encounter the problem. Your first step is to look at the latest Readme information main-
tained by the setup team on MSDN and follow the steps provided to solve the installation
problem. Here is the link: http://www.microsoft.com/express/support/.
Side-by-Side Installation
If you have a previous version of Visual Studio on your computer, say Visual Studio 2002
or Visual Studio 2003, installing Visual Basic 2008 Express Edition (or any Visual Studio 2008
product) will be straightforward. This is considered a side-by-side execution, and you can go
straight to the ā€œInstalling Visual Basic 2008 Express Editionā€ section about installing the
software.
Preparing to Install Visual Basic 2008 Express Edition
C A U T I O N
Please make sure you carefully
read the article at http://msdn2.
microsoft.com/en-us/vs2008/
bb964521.aspx before starting
the uninstall process!
Chapter 2: Installing Visual Basic 2008 Express Edition 17
Prerelease Versions of Visual Basic 2008 Express Edition
When you uninstall a prerelease version of any software, you might encounter problems.
At some point, you might have no choice but to reformat your hard disk and reinstall your
operating system. This situation is not uncommon when you work with prerelease software,
but there is a solution. Before beginning the uninstall procedure, and as a precautionary
measure, be sure to back up all your data. If possible, a good practice is to avoid installing
any prerelease versions of any products on your main computer. Using a test machine (or
virtual software) will help you avoid losing any important data and won’t slow your produc-
tivity in the event something goes wrong. You can learn more about the virtual solution that
Microsoft offers, called Microsoft Virtual PC 2007, at http://www.microsoft.com/windows/
virtualpc/default.mspx.
Luckily with Visual Studio 2008, all Community Technology Preview (CTP) and pre–Beta 2
versions were ā€œtime-bombedā€ virtual images provided by Microsoft; therefore, the chance of
ruining your main computer has been almost eliminated. You simply have to delete the
Virtual PC image provided by Microsoft, and you should be good to go with the released
version of the product. But if you have installed Visual Basic 2008 Express Edition Beta 2 and
you didn’t use a Virtual PC image, you will have to uninstall the beta version before you
proceed with installing the released version.
Installing Visual Basic 2008 Express Edition
Now that we’ve addressed a lot of potential issues and your computer is ready, you can
proceed with the installation. You will find a companion DVD with this book that contains a
full working edition of the product. Simply insert it into any available CD/DVD drive in your
system, and follow the steps listed next.
M O R E I N F O
Because of a new feature called
multitargeting, you can compile
any project to .NET 2.0, .NET
3.0, or .NET 3.5. After success-
fully installing Visual Basic 2008
Express Edition, you can safely
uninstall Visual Basic 2005 Express
Edition because with Visual Basic
2008 Express Edition, you can tar-
get .NET 2.0 and also get the ben-
efits and new features of Visual
Basic 2008 Express Edition.
N O T E
Even though Microsoft doesn’t
officially support prerelease ver-
sions of the software, you will
find resources on Microsoft’s
Web site to help you with instal-
lation. In particular, you will find
information on how to uninstall
(and in what order to uninstall)
the products. Look at the forums
at the following address for help
on uninstalling any Beta 2 instal-
lations (you’ll need to sign in
using a Windows Live ID to get
to this article): http://forums.
microsoft.com/msdn/showforum.
aspx?forumid=1346&siteid=1.
18 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
TO INSTALL VISUAL BASIC 2008 EXPRESS EDITION
If autorun is enabled, the installation process should start automatically. If it doesn’t start
automatically after a few seconds, follow these steps:
1. Click the Start button, and then click Computer.
2. Right-click the CD/DVD drive that has the product media, and select Explore.
3. In the list of files, locate and double-click Setup.hta to start the Installation Wizard.
4. On the Welcome to Visual Studio 2008 Express Editions Setup page, click Microsoft Visual
Basic 2008 Express Edition.
Within a few seconds, you should see that
the setup program is copying all the neces-
sary installation files to a temporary folder, as
shown in Figure 2-1.
When the setup program is done copying
the files, the setup application loads into
memory. While the application is loading,
you’ll see an initialization progress bar, as shown
in Figure 2-2.
Next, you’ll be greeted by the Welcome to Setup page
(Figure 2-3), which provides some information about the
product and the possibilities you’ll have working with it.
You can select the check box if you want to send anony-
mous data about your experience installing the product to
Microsoft. This program is totally anonymous, and you can
read the policy to see exactly what type of information will
be sent. Click Next to continue or Cancel to exit the installation program.
To continue the installation process, you must read and accept the license terms
(Figure 2-4). Please read the terms carefully to see what you can and can’t do with this
product. When you have finished and you’re ready to accept the license agreement, select
the option button that says you have read and accepted the license, and then click Next to
continue.
I M P O R TA N T
If you install Visual Basic 2008
Express Edition on the Windows
Vista operating system, you
should be prompted by the
Windows Vista User Access
Control dialog box to give the
setup process permission to
continue. If you have been using
Windows Vista for a while, you
have probably seen this dialog
box many times. Click Continue
to proceed with the installation.
Figure 2-1
Copying setup files locally to a temporary folder
N O T E
You’ll have nothing to do but wait
at this point. The wait should not
be long—less than a minute in
most cases, depending on your
computer’s speed.
Figure 2-2
Initializing the setup process
M O R E I N F O
You’ll see a check box at the
bottom of the License Terms
page that enables Visual Studio
to receive and display plenty of
useful information, such as tips,
blogs, and samples about .NET
and Visual Basic. If you clear it,
you can always select it again
after the product is installed by
using the Tools menu.
Chapter 2: Installing Visual Basic 2008 Express Edition 19
Figure 2-3
Welcome to Setup page
Figure 2-4
License terms
The Installation Options page appears, as shown in Figure 2-5. On this page, be sure to
specify that you want access to the Help system (MSDN Express Library) and Microsoft SQL
Server 2005 Express Edition.
SQL Server 2005 Express Edition is a relational database management system (RDBMS)
with which you can easily manipulate data in your application. This is an important step. For
example, if you’re creating the DVD collection management application that is included as
one of the Starter Kits, all the data related to your DVD collection will need to be stored in a
database using SQL Server 2005 Express Edition.
N O T E
The only reason not to install the
local MSDN Help or SQL Server
2005 Express Edition is limited
hard disk space. Be sure you
understand the consequences
of your selections. If you don’t
install MSDN Express Library,
you’ll need access to the Internet
to get help from MSDN Online. If
you don’t install SQL Server 2005
Express Edition, you won’t be able
to create applications that need
to access other sources of data,
such as Microsoft Access database
information, XML files, or other
types of RDBMS information. In
addition, some sample files from
this book won’t work automati-
cally, and you’ll have to perform
some manipulations or re-instal-
lations to get them to work.
20 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
Figure 2-5
Setting your installation options
The last product to install is Silverlight. Although we won’t use Silverlight directly in this
book, I strongly recommend you install it because you will have a smoother and richer
experience on many Web sites. Silverlight 1.0 will not take up a lot of disk space, because it is
only a few megabytes.
When you’re done with your selections, click Next to continue.
The Destination Folder page appears, as shown in Figure 2-6. This page will ask you
where to install the software on your computer. I recommend you use the default location.
Click Install to start the installation. The installation progress bar appears, which means
the installation is underway! (See Figure 2-7.) This might be a good time to get something to
drink because the installation could take some time.
M O R E I N F O
Silverlight, previously named
WPF Everywhere (WPF/E), is a
cross-browser, cross-platform
plug-in for delivering the next
generation of .NET-based media
experiences and rich interactive
applications for the Web. From
a user point of view, Silverlight
behaves like Adobe Flash, but
Silverlight is richer in terms
of what you can do and, more
specifically, how you can do it.
With Silverlight 2.0, for example,
you will be able to use your
Visual Basic skills and expertise
to develop Silverlight applica-
tions. You can find nice samples,
documentation, and much more
about Silverlight at http://www.
silverlight.net.
C A U T I O N
If you choose to install the soft-
ware in a folder other than the
recommended default, you might
have problems working with
some of the paths and files men-
tioned later in the book. If you
do install in a different location,
rest assured I’ll give you some
cautionary notes whenever you
might run into problems.
N O T E
The installation time will vary on
the basis of your choices on the
previous page. On average, if you
selected both MSDN Library and
SQL Server 2005 Express Edition,
the installation should take about
10 to 30 minutes, depending on
your computer’s speed.
Chapter 2: Installing Visual Basic 2008 Express Edition 21
Figure 2-6
Destination Folder page
Figure 2-7
Installation Progress page
Here is the list of components that will be installed:
The .NET Framework 3.5
ā–  This was the outer circle of the image illustrated in
Figure 1-1.
Visual Basic 2008 Express Edition
ā–  This is the tool itself.
Microsoft SQL Server Compact 3.5
ā–  This is a version of SQL Server that lets you, as
the developer, embed a compact database on smaller devices, such as Windows Mobile–
based phones or even on your Windows–based desktop or laptop.
MSDN Express Library for Visual Studio 2008
ā–  This was described earlier.
SQL Server 2005 Express Edition
ā–  This was described earlier.
When the Setup Complete page appears (see Figure 2-8), you are now finished with the
installation. That wasn’t too painful, was it? Before you click the Exit button, please read the
following notes.
22 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
Whenever you install a new application, it’s always a good habit to go to Microsoft
Update (http://update.microsoft.com) or Windows Update (http://windowsupdate.microsoft.
com) to get all the high-priority updates. Or you can click the Microsoft Update hyperlink
from the setup application, as shown in Figure 2-8. I prefer Microsoft Update because you get
all the updates you need for all the Microsoft software already installed on your hard disk.
You’ll get updates for Windows, the Microsoft Office system, SQL Server, Windows Defender,
and the .NET Framework along with your hardware drivers updates, all in one stop!
It’s also important to verify that your antivirus application
and its signatures are up-to-date and that you have updated
antispyware installed. Finally, in Control Panel, open the Security
Center, and make sure all lights for the firewall, virus protection,
automatic updates, and all other security settings are green. If
not, address those issues to prevent any security hazards.
Click the Exit button when you are done. If you elected to
send the feedback of your installation to Microsoft on exit, the
setup application will send it to Microsoft’s servers, as shown in
Figure 2-9.
Figure 2-9
Sending installation feedback to the
Microsoft servers
T I P
In the future, more products will
be added to the list of products
supported by Microsoft Update.
Figure 2-8
Setup Complete page
Chapter 2: Installing Visual Basic 2008 Express Edition 23
In Summary…
This chapter focused on installing Visual Basic 2008 Express Edition. It addressed most
issues you might encounter during the installation, it covered different setup scenarios, and it
provided links to MSDN for more help.
After working through this chapter, you should now have the .NET Framework 3.5, Visual
Basic 2008 Express Edition, MSDN Express Library for Visual Studio 2008, SQL Server Com-
pact 3.5, Silverlight 1.0, and SQL Server 2005 Express Edition installed and ready to go. Your
computer should also be up-to-date with all updates installed and all security settings on
green.
Whenever you’re ready to explore the integrated development environment (IDE) and
write your first two applications, just jump to the next chapter.
Microsoft Visual Basic 2008 Express Edition Build a Program Now Pelland
3 25
Three Types of
Applications: What Are
the Differences?, 26
Getting Started with the
IDE, 28
Building the Projects, 31
Chapter 3
Creating Your First
Applications
You’ve installed Microsoft Visual Basic 2008 Express Edition, so now it’s
time to create your first applications. You’ll start this chapter by learning
about the differences between console applications, Windows applications,
and Windows Presentation Foundation (WPF) applications. You’ll then look
at the integrated development environment (IDE). As its name implies, the
IDE is the application that provides all the tools you need to design, plan,
develop, and distribute your applications. You could use any text editor, such
as Notepad, for example, to create your applications, but in this chapter and
for the reminder of the book, you’ll be using the IDE.
Most programming books usually start with a fairly simple application
called ā€œHello, World.ā€ Your first application will be a simple application as
well, but you’ll be creating an application that does a little bit more than just
say ā€œHelloā€ to the world. Specifically, you’ll learn to create an application that
adds two numbers together and outputs a result. With this application you’ll
also learn about Solution Explorer as well as the documentation and Help
system built into Visual Basic 2008 Express Edition.
26 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
In this chapter, you’ll create two versions of the same application: a console application
and a Microsoft Windows application. You might wonder why you even have to worry about
the type of application when you’re creating a program. Often, the type of application you
create depends on the purpose of the application and how users will interact with it.
Sometimes your application doesn’t need to have a graphical interface. For instance,
some applications need to be executed in a script or a batch file, or they don’t need a
graphical interface because no user usually interacts with the application except to start it.
This type of application is called a console application because everything is displayed in a
system console window. You might have heard these types of windows referred to by many
different names: a DOS window, a command prompt window, or simply the command
window. The most common output in a console application is simple text.
Figure 3-1 shows the result of the famous ā€œHello, Worldā€ application as a console
application.
Figure 3-1
A console application
Three Types of Applications: What Are the Differences?
N O T E
Please note that console appli-
cations are still executed in
Windows but in the console.
M O R E I N F O
Simple text (also called ASCII characters) is the usual output of a console
application, but some console applications use ASCII graphic characters.
(ASCII stands for American Standard Code for Information Interchange.)
An ASCII code is the numerical representation of a character (such as 0
or #) or an action of some sort. Pressing Enter in a word processor to
move to a new line of text is an action represented by an ASCII character,
for instance. The ASCII graphic character set, also called extended ASCII
characters, includes vertical lines, vertical double lines, corners, and much
more. ASCII characters are sometimes used to create boxes around text in
console applications. Unicode characters are similar to ASCII but are not
encoded in the same way. They are more extensive and can represent dif-
ferent locales.
N O T E
Console applications can be
written in many different pro-
gramming languages (C, C++,
C#, Visual Basic, and so on) and
scripting languages (Perl, Python,
JScript, and so on).
Chapter 3: Creating Your First Applications 27
Console applications can be much more complex
than the ā€œHello, Worldā€ example shown here. In fact,
they can have as rich a set of features as Windows
applications. The only difference is that they don’t have
a graphical interface. For example, in corporate data
centers, many applications execute all day and night,
producing a large amount of data. It would be time-
consuming and problematic to rely on people to verify
the data. So, data centers are usually highly automated
to facilitate this job; they use console applications that
produce, manipulate, and verify the data in scripts or
batch files.
In contrast to a console application, a Windows
application has a graphical interface, as shown in
Figure 3-2. (This type of application is also called a Windows
Forms application in .NET.)
These applications are usually accessible from the Windows
Start menu, and by default they share some common characteristics,
such as a Close button, a Maximize button, and a Minimize button, as
shown here:
A third type of application—a WPF application—also
has a graphical interface and looks similar to a Windows
application; however, WPF applications use a completely
different set of libraries to generate their executable
files. For our work in this chapter, it is enough to say that
WPF applications can provide a richer experience and
use a different approach for their design.
Figure 3-3 shows a WPF application in action. I will
explain them much more fully in Chapter 6, ā€œModifying
Your Web Browser.ā€
Figure 3-2
A Windows application includes a graphical
interface.
Figure 3-3
A WPF application
N O T E
A Windows service is a type of
Windows application that runs
on Windows in the background;
it doesn’t have a user interface,
doesn’t produce any visual out-
put, starts when Windows starts,
and doesn’t even require a user to
be logged in to start executing.
Windows XP Service Pack 2 (SP2)
and the Windows Vista operat-
ing system come with roughly
four dozen Windows services. For
example, one built-in Windows
service validates your user name
and password at start-up.
28 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
To get started writing the code for the console version of your first application, you’ll need
to start Microsoft Visual Basic 2008 Express Edition. To do this, follow these three easy steps:
click Start, click All Programs, and then click Microsoft Visual Basic 2008 Express Edition.
Before we go further, let’s pause and admire the IDE in all its glory. Look at Figure 3-4,
and feel the excitement.
Figure 3-4
The IDE in all its glory
Getting Started with the IDE
N O T E
The first time you start Microsoft
Visual Basic 2008 Express Edition,
it will take some time to load
because the IDE is being config-
ured for the first time.
Chapter 3: Creating Your First Applications 29
If you’re not feeling the excitement yet, you soon will be. The development environment
has been designed to make a lot more information available up front and to make you more
productive more quickly. From this screen, everything you need to build an application is
available in a couple of clicks. This is where you type your code, compile your code, launch
the application, find your mistakes and fix them, get help on the syntax, and perform many
other tasks. Furthermore, the Visual Basic 2008 Express Edition IDE is designed to generate a
lot of code for you so that you have less to type. If you didn’t have the IDE and you wanted
to write a Windows Forms application, you would have to type a lot more code, and this is
prone to errors. With the IDE, most of the actions you’ll perform will automatically generate
the code for you behind the scenes.
As you spend more time with the IDE, you’ll find that there are many ways to perform
the same actions. For instance, to complete a specific action, you can use a series of menu
choices, you can use a keystroke shortcut, you can click an icon on a toolbar, you can click a
hyperlink in a page, or you can right-click and choose an option from a context-sensitive
menu. Before diving into our first application and before writing some code, we’ll go
through each big component of the IDE.
The first page you see when you start the IDE is a really useful one: the Start Page. It
contains a lot of useful information:
Recent Projects pane
ā–  Here you’ll get the list of projects or solutions that were
recently opened. You can also create a new project or open an existing project that is
not in the list.
Getting Started pane
ā–  I call this useful pane ā€œHelp Centralā€ because if you need
quick help, this is one of the best places to get answers. Whether you need help with
some Visual Basic constructs, you want to see a list of how-to articles, or you simply
want hyperlinks to communities of programmers, you can often find these items in the
Getting Started pane of the IDE.
Visual Basic Express Headlines pane
ā–  This is where you find specific news about Visual
Basic Express Edition from Microsoft. These product headlines deliver special messages
specific to Visual Basic 2008 Express Edition and announce new updates, new releases,
new code snippets, or anything that needs attention on your part.
T I P
The first and only rule of this
book is to not be afraid to experi-
ment. Click, look, read, and try
whenever possible. This is really
the best way to learn. I’ll show
you some important material,
tips, and tricks throughout this
book, but my advice to you is to
go beyond these examples and
just try and try and try.
N O T E
I will show you how and where
to look for this generated code
in Chapter 5, ā€œUsing Rapid
Application Development Tools
with Visual Basic 2008.ā€
N O T E
Some hyperlinks on the Start
Page require a live connection to
the Internet. So if you are unable
to read the hyperlinks, please
verify your Internet connection
status.
30 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
MSDN feeds
ā–  This pane of the Start Page includes hyperlinks to articles from one of
MSDN’s Really Simple Syndication (RSS) feeds. You can configure these articles for any
valid RSS feed from the Web. The default is set to the MSDN Visual Basic 2008 Express
RSS feed. These articles are usually different from the ones under Visual Basic Express
Headlines; occasionally they might be the same, but the articles from MSDN cover not
only Visual Basic Express Edition but also topics including Visual Studio Team Systems,
Microsoft SQL Server, Web services, and so forth. You can modify the feed by clicking
Tools and then Options, expanding Environment, selecting Startup, and updating the
Start Page News Channel field with a valid RSS feed of your choice..
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 options available change based on the current
context. For example, when you don’t have a project open, you have fewer menu choices:
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 popular
actions that you can also perform by going through the menus.
Toolbox
ā–  The Toolbox contains controls that are used in your applications. If you scroll
over the Toolbox on the left side of the Start Page, the Toolbox will expand. If you don’t
have a project open, the Toolbox will be empty. 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 boxes, menus,
toolbars, and so on. I’ll explain these controls in greater detail in Chapter 5.
Solution Explorer
ā–  This feature lists the files and components in your project. If no
project is open, it will be empty. You’ll learn more about Solution Explorer later in this
chapter.
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
N O T E
The Microsoft Developer Network
(MSDN) is a set of online and
offline services designed to help
developers write applications
using Microsoft products and
technologies.
N O T E
If you don’t see Startup and other
settings in the Options dialog
box, ensure that you select the
Show All Settings check box
in the lower-left corner of the
Options dialog box.
T I P
If you accidentally close the Start
Page and you want to display
it, you can always get it back by
clicking View, Start Page.
Chapter 3: Creating Your First Applications 31
message on your screen such as ā€œLoading project c:blablablabla.vbproj 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ā€ depend-
ing on the success of the process.
Building the Projects
From this point on, you’ll focus on what you really came here to do: build some projects.
Let’s start with your first application—the console version of the application that adds two
numbers together.
Building a Console Application
We’ve been talking about what a console application can do and what it will look like, so
why don’t we build one? In this section, you’ll create a simple mathematic application.
TO BUILD A CONSOLE APPLICATION
1. If Visual Basic 2008 Express Edition is not running, start it by clicking Start, All Programs,
Microsoft Visual Basic 2008 Express Edition.
You can choose to start building your application either by clicking the New Project icon
on the toolbar, by selecting Create: Project from the Start Page, or by clicking File, New
Project on the menu bar.
2. In the New Project dialog box, select Console Application in the Templates section, and
type MyFirstConsoleApplication in the Name box. The New Project dialog box should
be similar to the one in Figure 3-5. Click OK to create the project.
T I P
For demos and samples, I recom-
mend you type all the source
code in the following examples
so that you can better understand
the concepts involved. However,
for longer source code listings,
you can also download the com-
pleted code samples (http://
www.microsoft.com/mspress/
companion/9780735625419).
N O T E
By default in Visual Basic 2008
Express Edition when you click
OK, projects are created in a
temporary location. When you
save or close the project, files are
saved in DocumentsVisual Studio
2008Projects. (On Windows XP
and Windows Server 2003, you’ll
find them in My Documents
Visual Studio 2008Projects.)
You can change the default proj-
ect location by clicking Tools,
Options, Projects and Solutions
and finding the first text box
named Visual Studio Projects
Location. We’ll look into what
files are created and what their
content is in Chapter 5.
32 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
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 look like the one shown in Figure 3-6.
Getting to Know Solution Explorer
Before you write the code, you need to learn about Solution Explorer. Shown on the right
side of the screen in Figure 3-6, Solution Explorer provides an organized view of your
projects and all the files 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, the resource files (such
as the application icon), the configuration files, and so on, in Solution Explorer.
T I P
If you accidentally close Solution
Explorer, you can get it back by
clicking View, Solution Explorer.
Chapter 3: Creating Your First Applications 33
Figure 3-6
MyFirstConsoleApplication without the code
If you want more information about 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 disposal.
T I P
Note that the Start Page is still
available; it’s simply a separate
tab. You can go to any window by
clicking a specific tab or by press-
ing Ctrl+Tab.
34 Microsoft Visual Basic 2008 Express Edition: Build a Program Now!
Getting Help: Microsoft Visual Studio 2008
Express Edition Documentation
If you want to read more about Solution Explorer, you need to be introduced to Help
and the documentation system. You access the documentation by pressing F1 from within
Visual Basic 2008 Express Edition or by using the Help menu. The first time you press F1 or
use the Help menu, you’ll be greeted with the Online Help Settings dialog box, as shown in
Figure 3-7.
Figure 3-7
Online Help Settings dialog box
This dialog box 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 local Help as the primary source; otherwise, choose online
Help as your primary source since it is the best source for the latest information.
Chapter 3: Creating Your First Applications 35
Once you’ve made your selection, you’ll see the documentation’s graphical interface, as
shown in Figure 3-8.
Figure 3-8
Microsoft Visual Studio 2008 Express Edition documentation
The toolbar at the top of the window includes several interesting elements that will
help you find exactly what you need. Figure 3-9 shows the most important buttons on the
toolbar.
Another Random Scribd Document
with Unrelated Content
ā€œThe public debt, enormously increased for the last fifteen years,
the civil list, the crown revenue, the pensions of the royal family, are
not within the limits of our control. Every debt is sacred, but some
are yet in suspense. For example, whilst all the European powers
were largely indemnified according to their pretensions (English
claims even to three times the amount allowed to French creditors),
had the United States shown some hostile feelings towards us, or
had they merely asserted their claims in concert with the other
powers, their demands would have been immediately liquidated. But
they have never yet been adjusted, because that nation would not
join the enemies of France, who were then to be found in her
bosom, notwithstanding what has sometimes been said at this
tribune to the contrary.
ā€œWith regard to the civil list, gentlemen, it might perhaps be
desirable, both for its proper management and the personal comfort
of the king, that the appropriations not included within the king’s
personal expenses should have been granted under the forms of
accountability adopted in the civil list of England.
ā€œThe appropriation for the criminal judiciary department furnishes
me another opportunity of again proffering my warmest wishes for
the abolition of capital punishment, which the uncertainty of human
comprehension renders so alarming, and which must particularly
appall those generations who have so irretrievably suffered from the
furies of parties; and also for the abolishment of branding, called for
on all sides. May the minister at the head of the judiciary
department affix his name to these two salutary measures!
ā€œOne of my honorable friends has adverted to the gratuitous
magistracy of English justices of the peace. I do not envy this
pretended benefit of our neighbors, and it is my opinion that those
great proprietors are not the most proper persons to exercise a
sovereign jurisdiction over all the petty offences committed within
their department; but I cheerfully concur in the unanimous voice for
restoring the principle of temporary election in justices of the peace.
ā€œNothing can be more gratifying to my feelings than to have
heard, on the last discussion on trials by jury, the pledge that the
propriety of extending the benefit of this institution to the
transgressions of the press will be taken into consideration at the
next session.
ā€œI cannot withhold my assent to the observations of the report on
the whole of ministerial budgets. I had myself said at this tribune in
1819, ā€˜It would be highly beneficial that every ministry should
inquire, with all conscientious severity, into what is necessary to the
due performance of their duties, and should propose in all remaining
details, terms as generous and complete as they please, for the
security and comforts of those actually in office, provided that
ministers should be divested of all parasitical service, and children
brought up to a more profitable labor than the industry of obtaining
situations, which is so detrimental to every kind of industry, and to
the independence of a vast number of citizens.’ The specification,—I
mean the application,—which can never be too minute, of every
appropriation to every item of expenditure, has already made some
progress; but how profuse those specifications, beyond which there
is ministerial exertion, when compared with English budgets, of
which I now hold in my hand three departments,—the artillery, war,
and navy; and yet this is not a cheap government, to use an
expression that has so often been charged upon me, and which I am
so unwilling to deny.
ā€œThe minister for foreign affairs has opened his career under the
most critical circumstances; his official duties will be dictated by the
loyalty of his personal character. The great political question is now,
to decide whether this government will continue to follow the track
of old diplomatic traditions, or whether, divested of all foreign
influence and reminiscence, it will boldly assume the rank it
behooves us to take at the head of European civilization; a post
which, in my opinion, has always remained vacant, notwithstanding
appearances contradicted by facts; a stand to which no foreign
power any longer dares lay any claim. From that exalted station,
France may and ought to resist coalitions in which none of her
interests are involved. For my own part, I should have expected
more satisfactory explanations and details before giving my assent
to the late loan of eighty millions, but none would more readily
consent to the measures necessary for the liberty and independence
of Greece; to enable her by assistance to defend herself; to erect a
barrier against the ambition of other powers; to abolish the
ignominious sale of fellow-beings, and rescue from slavery all those
wretched victims of whom our interference has hitherto been
inadequate to their deliverance; and in this I should foresee the
advantage of our commercial relations, which, in spite of narrow
prejudices, will always find a benefit in extending to other people the
blessings and comforts of education and liberty.
ā€œFrance, so long accustomed to triumph over the most formidable
coalitions, wonders at finding herself encumbered under petty
manœuvres, the mysteries of which she cannot unravel.
ā€œI will not mention our unfortunate and criminal expedition into
Spain, nor the cruel lessons given to despotism, oppression, and
aristocracy in the peninsula, the various and beautiful provinces of
which are, I hope, destined to a better fate. But I must beg leave to
call your attention to our enormous and foolish error with regard to
the new American states.... What blindness, gentlemen, what
complacency, can induce us obstinately to withhold our assent to the
recognition of the South American republics, in return for insult,
ingratitude, and bankruptcy? The British government itself, it is true,
although under the direction of an illustrious minister, hesitated a
while before adopting that step; but it no sooner saw the immense
advantages accruing to the United States, from the priority of that
recognition, and a timely official declaration of protection and
sympathy, than it hastened to associate itself in the honor and profit
of their new relations. After long expectations, gentlemen, France is
still reduced to those half-way measures that create mistrust and
discontent, whilst it is a well-known fact that French productions and
manufactures find a better market in that extensive territory than
those of all other nations.
ā€œWhilst the freedom of worship is guaranteed by the charter, and
its equality sanctioned by our new morals and habits, it is
unnecessary to remark that, even under the ancient rƩgime, Catholic
affairs never formed a special branch of the ministry. Amidst the
attacks of the pretended supporters of the altar, I will also deprecate
that cold fanaticism which endeavors to represent Christianity, an
institution originally founded on social equality, as hostile to the
rights and opinions of the people thus calling, as it were, for a sort
of retaliating animadversion against opinions and practices that are
totally distinct from worldly ambition. I will seek for the solution of
that inextricable dilemma of the duty of the priest, considered both
as speaking in the name of Heaven, and as a pay officer of state;
but where shall I find it but in that country where religious freedom
is more generally prevalent than in France, where the ministers of
religion are more respected, and sectarians live in peace; in that
government where no rights and regulations can give umbrage, but
where, being altogether foreign to and distinct from all civil
institutions and form of government, religious societies are formed
without restraint and choose their own ministers.
ā€œThe separation of the ecclesiastical department from the ministry
of public instruction, I consider as much an act of piety as of sound
judgment. But too much has yet been left to the infringements of
the Catholic clergy. It is not only a religion of the state, but also a
very prevailing one still to be found in those ordinances which ought
to have secluded its special dogmas within the walls of the church,
and confined its distinction of creeds to the circle of private families.
ā€œNational instruction, gentlemen, and especially elementary
education, that main-spring of public reason, of practical morality, of
public peace and comfort, is at present the first want of the French
population, as it is the first duty of government. You all know,
gentlemen, how this duty is to be discharged. Methods of instruction
have heretofore been protected in an inverse ratio to their being
perfect and easy. Neither your paltry vote of 50,000 francs, nor
500,000 francs, can be adequate to the redemption of that most
important of all social obligations. Under a competent and legal
system of public instruction, I would consider five millions as the
most desirable appropriation of a budget.
ā€œMany statesmen appear to have forgotten,—some perhaps have
never been aware,—that by the law of the 3d Brumaire, year IV.,
France was provided with the best system of instruction that ever
existed in any country. It could not be consistent with that power
which severed from the institute the class of moral and political
sciences. Napoleon created the university, the monopoly and
exigencies of which wounded the feelings of private families and
displeased the true friends of liberty, but which was afterwards
indebted to the invasion of Jesuitism, a privilege of another kind, for
the credit of being looked upon as a liberal institution. In order to
satisfy all parties it would be necessary, at the next session, to offer
a plan for the organization of public instruction, wherein all the
national duties of teaching should be strictly laid down, and all
individual liberties respected; but every plan of education,
particularly in its elementary bearings, would require the co-
operation of true civil administrations.
ā€œWhy is it, gentlemen, that in utter contempt of the most solemn
pledges, we have preserved for fourteen years the whole imperial
structure of the internal administration in France? those factitious
municipalities, those unsettled councils, those despotic and turbulent
prefectures and sub-prefectures, which have never been amended
except for successively adding to their inconveniences, attributions,
and appointments? When shall we see every section manage its own
concerns, provide for all its own exigencies, and retain within its
territory that portion of the taxes that we are afterwards compelled
to send back to it? Is this idea unknown in France? But the
constituent assembly, whatever has been said to the contrary at this
tribune, had not only proclaimed useful and true doctrines; it had
also organized a system of administration elected by the citizens,
and was abolished only by the consulate and by the empire. Is it
replete with such great difficulties? But when in 1815, Napoleon, in a
fit of liberalism, restored the municipalities in accordance with the
law of ’91, elections were made with remarkable celerity and
moderation. The only embarrassment that could arise would be in
the government, if instead of abiding by the dictates of eternal truth
and of contemporary reason, it found it necessary to combine
principle with exception, right with privilege, thereby perplexing and
deluding the purest intentions.
ā€œI will follow the report of the committee in the examination of the
war department, merely with the view to support the proposition of
placing in the civil list the payment of the king’s military household.
You have also heard on this subject the excellent discourse, to which
my honorable friend, General Gerard, has given all the weight of his
experience and of his glory. The minister of war, in offering
observations that will be made the subject of future deliberations,
has just expressed his desire of completing our system of defence.
Here, gentlemen, we naturally bring back to our memory the urgent
call recently made by the ministry upon our patriotism to obtain the
means necessary to a preserving policy, a respectable military
strength, a guarantee of public tranquillity, a national dignity; and to
an union of the people with the government. The minister had
before represented the nation rising in a body at the voice of their
king. I will not attempt, gentlemen, the solution of the problem; the
knot has been untied by a celebrated writer whose authority is daily
referred to.
ā€œThe stationary National Guard, says an ordinance of the king,
dated March, 1815, comprising a mass of three millions of landed
and industrious proprietors, constitutes a local force extended on
every point....
ā€œFrom this formidable mass, whose dearest interests attach them
to the soil, may be formed voluntary corps constituting movable
columns....
ā€œThus the nation, fighting on every point with the army, either in
the line or as auxiliaries, will prove that a great people cannot
unwillingly be brought under the yoke that they have once shaken
off.
ā€œGentlemen, I will only remind the government that eight years
ago, in the session of 1820, the ministers then acknowledged that
they had been in possession, for eight months, of the project of a
law drawn up by a special commission, and you all know how it has
hitherto resulted.
ā€œThe glory of the French navy has resounded in every heart. The
name of Navarino has been proclaimed with an unanimous concert
by the throne and in the chamber, as it had been echoed by the
whole nation; the brave Admiral de Rigny is perfectly secure against
the censure of a recall. The infamous traffic of human flesh has been
partly suppressed, but it is not yet totally extinct. With an entire
confidence in the sentiments of the minister of marine on these
important questions, I submit to his wisdom the idea of placing the
slave trade on the same footing as piracy, as the law of the United
States has given the example, since followed by England. With
regard to the management of our colonies, gentlemen, there is so
much to say that I could not briefly enter on the subject. I will
merely remark that the system of colonization of the ancients is, in
any opinion, much preferable to that of modern times.
ā€œIn the law under consideration the minister of finance has
undoubtedly surpassed all his colleagues; but when a thorough
discussion is about taking place, I do not feel sufficient confidence to
anticipate the opinions that you will hear from colleagues more
learned and more skilful than myself. I should even consider myself
worthy of reproach, had I not made it a duty to offer some of my
ideas, but especially to call at this tribune for more effectual social
reforms than can possibly be achieved by way of amendments.ā€
La Fayette was constantly the recipient of attention and
distinguished honors, both in America and in France. The young men
of Auvergne gave him a splendid banquet on the 23d of June, 1828.
The old general’s toast was: ā€œTo the assembled young men of the
three departments of Auvergne, and to our dear mountains; the
volcanoes of these are extinct, but the sacred fire of liberty will
never be extinguished among them.ā€
The marquis never forgot any of his friends, especially his
American comrades, and his affection for the fathers was continued
to the sons, as the subjoined letter to Charles A. Clinton, written to
him by La Fayette upon receiving the news of the death of his father,
De Witt Clinton, will demonstrate.
ā€œParis, March 30, 1828.
ā€œMy dear Sir: Your personal and friendly attentions to me make
you a natural organ of the melancholy and affectionate feeling which
I wish to be conveyed to the family of your lamented father. I regret
the mournful and unexpected event as an immense loss to the
public, and a great personal cause of grief to me. Bound as I was to
the memory of my two beloved Revolutionary companions, your
grandfather and grand-uncle, I had found a peculiar gratification in
the eminent talents and services of their son and nephew, and in his
kind and liberal correspondence, until personal and grateful
acquaintance had impressed me with all the feelings of a more
intimate friendship. I beg you to be to your afflicted family the
interpreter of my deep sympathies, and to believe me forever
ā€œYour most sincere friend,
ā€œLa Fayette.ā€
At the celebration of the commencement of the Ohio and
Baltimore Railroad, which occurred on the 4th of July, 1828, a pair
of handsome morocco slippers, and a pair of beautiful white satin
shoes were made by the cordwainers during the procession. The
morocco slippers were presented to the venerable Carroll, on the
ground; and the white satin shoes were subsequently transmitted
to General La Fayette, together with the badges worn by the
association. This compliment received the following reply:—
ā€œLagrange, Sept. 11, 1828.
ā€œGentlemen: With affectionate feelings of pleasure, I have
received your kind letter, the badge bearing a likeness of our
matchless Washington, and of my excellent friend, the surviving
signer of independence, the ensigns of your association as they
were worn by your worthy president, and an elegant pair of ladies’
white satin slippers, which were manufactured in the procession.
For those gratifying marks of your remembrance and friendship, I
beg you to accept my most grateful thanks. The anniversary of
American independence, the commencement of the Baltimore and
Ohio Railroad, have been happy associations. So I have seen, as it
were, the commencement of your city in the first years of the
Revolutionary struggle, of which this very day is one of the (1777)
anniversaries, that of the battle of Brandywine; and it has been
lately to me a matter of proud delight to witness the immense
progress of Baltimore, a great and rapid increase of which we may
now more than ever anticipate. Its happy effects upon every sort
of trade and industry cannot be doubted, and I offer you the
cordial congratulation and good wishes of your sincere and obliged
friend,
ā€œLa Fayette.ā€
The general also transmitted the following to the book-binders
of the city, and to the editors of the American:—
ā€œLagrange, Sept. 11, 1828.
ā€œTo the book-binders of Baltimore.
ā€œGentlemen: With a lively sense of gratitude, I have received your
kind letter, and a copy of the apron and badge which on the late
celebration, doubly dear to an American heart, were worn by the
book-binders of Baltimore. Testimonies of your remembrance and
affection are at all times highly gratifying to me, nor could they
prove more welcome than on this momentous occasion, when the
anniversary day of independence is hailed in common with the
commencement of one of its most promising results, amidst the
immense progress of every kind that has taken place since it has
first been my happy lot to be admitted as a soldier of the United
States, and particularly as a citizen of Maryland. I am proud to
have been enabled to show specimens of American book-binding
which every day excite European admiration. I beg you,
gentlemen, to accept the respectful acknowledgments and
affectionate good wishes of a veteran who would have been
happy, in the procession, to have followed his venerable friend, the
surviving signer of the glorious declaration; and to have expressed
to you, on that great day, the sentiments of his deep gratitude and
warm attachment.
La Fayette.ā€
ā€œAfter other business during the second session of the twentieth
Congress the Vice-President communicated a letter from the
President of the United States, transmitting one received from
Monsieur David, the artist, member of the Institute of France,
professor of the School of Painting at Paris, and member of the
Legion of Honor, who presents to Congress the bust of General La
Fayette, which has been received with it.ā€
The following is a translated copy of the letter:—
ā€œParis, Sept. 11, 1828.
ā€œTo the President: I have made a bust of La Fayette, and would
willingly raise a statue to his honor—not for himself, because he
has no need of it, but for ourselves, who approve in so lively a
manner the desire of expressing to him the affectionate regard
and admiration with which we are inspired. The youth of the
French nation is filled with admiration for the virtues of the youth
and the old age of him whose likeness I send you.
ā€œThey envy the glory that was acquired upon the American soil,
by the side of the immortal Washington, and the defence of your
noble rights.
ā€œThey envy that glory which has been acquired on the soil of
France, in the midst of the troubles of Paris and of Versailles,
where, in breasting the storm, he wanted courage as little in the
struggles of debate as he did in contending with the sword. They
envy the glory which covers the brow whitened by age, but still
sparkling with the fire of liberty and of patriotism.
ā€œIt is in the name of this youthful feeling of the French nation,
ambitious to imitate everything generous and great, that I offer
you a work upon which my hands have been employed for some
time and with great care.
ā€œI could wish that it was more worthy of the subject—more
worthy of the place which I am desirous to see it occupy. Yes, sir, I
could wish that the bust of our brave general, of our illustrious
deputy, should be elevated on a pedestal in the audience chamber
of Congress, near the monument erected to Washington himself;
that the son be placed by the side of the father, or, if you please,
that the two brothers in arms, the two companions in victory, the
friends of order and of law, may be no more separated in our
estimation than they were in their devotion to the cause of liberty
and in the hour of peril.
ā€œLa Fayette is one of the ties that unite the two worlds. He
visited the new one to remain there for a few months, and to
salute once more your sacred land of justice and equality, and has
returned to us after having partaken of your feasts and received
the honor and the benediction of your nation.
ā€œI hasten to render my homage in return—I present you with his
image. It will be a memento that the original may often recall to
the National Assembly those eternal principles upon which the
independence of the state reposes, and which are the foundation
of their safety.
ā€œI am, with profound respect, Mr. President, your very humble
and obedient servant,
ā€œDavid,
ā€œMember of the Institute of France, and
professor in the School of Painting; member
of the Legion of Honor.ā€
The following is a description of the bust as given in the National
Intelligencer:—
ā€œThe bust is of a fine white marble, and is the work of P. J.
David, of D’Angers, in France.
ā€œIt is of a size larger than the life, and exhibits a fine likeness of
that distinguished apostle of liberty. On the front is ā€˜Au gĆ©nĆ©ral La
Fayette,’ and the name and residence of the artist, with the year
(1828) of its execution. On the left side is an inscription, indented
in the stone, in the following words: ā€˜La Fayette’s speech in the
House of Representatives, Dec. 10, 1824.—What better pledge can
be given of a persevering national love of liberty, when these
blessings are evidently the results of a virtuous resistance of
oppression, and institutions founded on the rights of man, and the
republican opinion of self-government?’
ā€œOn the right side is the following:—
ā€œā€˜La Fayette’s last words in his answer to the President’s farewell
speech, Washington, Sept. 7, 1825: God bless you, sir, and all who
surround us. God bless the American people, and each of their
states, and the federal government. Accept this patriotic farewell
of an overflowing heart; and such will be its last throb when it
ceases to beat.ā€™ā€
The New York American of December, 1828, says:—
ā€œA letter from General La Fayette, of December 29, from
Lagrange, tells us—and as he belongs to the nation, we may
repeat—that Madame Perier (the eldest daughter of Mr. George La
Fayette) has just made him a great-grandfather. The same letter
says, ā€˜I expect to be in town in a few days, and enjoy the
agreeable American society which has convened there from the
several parts of the Union. It will be something like a Washington
winter.ā€™ā€
The following is the substance of General La Fayette’s address at
the Fourth of July dinner in Paris, in 1829:—
ā€œThe health of their venerable guest, General La Fayette, having
been given, the general in returning thanks, stated the pleasure
which he felt in celebrating this anniversary, which enabled him, as
it were, again to breathe the American atmosphere. He spoke with
high gratification of their associating him with the principles for
which he had struggled under the illustrious and well-beloved
Washington. The independence of the United States began a new
era of political civilization, which will finally extend over the whole
world, and which is founded on the natural rights of mankind. He
was proud to own that the first declaration of those rights bore the
indelible imprint of its American origin. He referred in eloquent
terms to the delight with which all generous minds had hailed the
recent triumph in Great Britain over religious intolerance, and
earnestly advised the Americans in consolidating their constitution
not to listen to European suggestions, nor admit any exotic
materials. He concluded by giving a toast to ā€˜National Legitimacy,’
which, while it choked and destroyed the weeds of privilege,
nourished the roots of natural and solid right.ā€
In 1829 General La Fayette came into possession of a large
property under the indemnity law, being the fortune of his own
and his wife’s family, of which the Revolution had deprived them.
We will quote from one more speech of La Fayette, in the French
Chamber of Deputies, on the 9th of July, 1829. The question under
discussion was the accordance of an eventual credit of fifty-two
millions of francs.
ā€œGentlemen,ā€ said La Fayette, ā€œthough I have voted against
approving the budget of expenses, in the hope that its refusal
would prove a prompt and efficacious means of obtaining those
institutions and economies which France has for so long a time
expected, yet I feel disposed to vote in favor of the credits
demanded, provided the chamber receives those explanations
which it stands so much in need of. I do not see in the great
quarrel of the east, as regards ourselves, anything beyond our
importance as an intermediate power in what is called the balance
of Europe; only two classes, the oppressors and the oppressed; in
the demarkation of states, nothing but their natural limits; in the
well-being of a people, nothing but the advantage of all; and in
the policy of France, nothing but a liberal and independent part to
act. You know, gentlemen, that great and powerful alliance which
would enslave and brutalize the human family. It covers the
peninsula with blood, oppresses Italy, and throws other states into
disorder. Vienna is its metropolis, and in spite of other pretensions,
Don Miguel is its ideal type.
ā€œEngland has pretended to favor the world with another beacon,
whose light is sometimes extinguished, and at other times shines
but to decoy; upon this point inquire of Italy, of Spain, and of
Portugal. It is for France then, gentlemen, which finds herself
more in accord with our ideas of the new civilization, to place
herself at the head of that civilization; in that consists her glory
and her interest; there, too, in case of need, will be found her
ambition; and there, also, the dignity and the safety of her
government. But to perform that noble task it is necessary that the
government resolve no longer to fear either a representative or an
armed nation, and that abandoning its former relations, it may be
able to say to foreign powers, ā€˜Next to God, it is to the people of
France that I am indebted for being elevated above your influence
and beyond your pretensions.’
ā€œI will confine myself, gentlemen, to a few remarks on the
grounds to which our attention has been invited by the application
made for the credits now under consideration.
ā€œSome of my honorable friends have spoken harshly of the
expedition to the Morea; they have even thought that it was in no
degree whatever entitled to public approbation; but I have so
ardently desired some kind of interference, particularly French
interposition, in behalf of Greece, that I cannot join them in their
criticisms, and as to our portion of that generosity which was
manifested in the relief afforded, without speaking of Russia,
whose motives are obvious, it would be sufficient to advert to two
discourses from the throne, in one of which the battle of Navarino
is called by Charles X. glorious, while from George IV. it received
the appellation of untoward, to prevent us from confounding the
shades of the two interests in the cause of Greece, and to mark
the distinction between the cannonading at Terceira and the
hospitality at Brest. The last protocol, however, from London has
humbled my pride and diminished my expectations.
ā€œWhy, gentlemen, have the Greeks taken up arms? why have
they endured so many calamities? why have they so freely shed
their blood? It was to free themselves from paying tribute to the
Turks; to build up again their ancient country; and to enjoy in their
own way the blessings of self-government. But now, gentlemen,
the protocol brings into fresh existence the odious tribute; the
greatest part of Greece is shut out from Greece, and to govern the
small portion which remains it is proposed to look, I know not
where, or for whom, but for some foreign prince, a hospodar, a
mongrel of the East and of the West, in whom the Greeks will only
behold a vassal of the Porte, and for whom they must pay an
additional tribute.
ā€œAll this, gentlemen, may be very agreeable to Russia, which
dreams already of new subjects there; and to England, which has
always feared that in that country she would find rivals in the
coasting trade; but not to France, whose interest it is to have there
a friendly and powerful nation, a barrier against the conquering
and commercial ambition of other powers. Upon that topic it is
that we look for explanations. The government of Italy is enslaved
by the influence of Austria. Italy, were she free, would be our
friend. Spain, whose methods of justice consist in strangling by
turns the patriots and the Carlists, will never, in truth, be our ally
until she again becomes constitutional.
ā€œAs to Portugal, it is in vain that the English government has
lately sought to balance the mock sovereignty of the cortƩs of
Miguel against those institutions which the British ambassador, let
it be said, by the by, had imported for it from Brazil.
ā€œGentlemen, the partisans of national laws cannot accept this
concession; there is no legitimacy there where nothing can be
found but a despotic violation of all rights, social as well as natural.
Besides, we do not know in what manner these pretended cortƩs
have been formed, and how the deputies, who were not of
Miguel’s choice, were rejected. Let us hope, gentlemen, that public
indignation, and the stupid attacks which have been lately made
on the flags of other nations, will soon put an end to this infamous
usurpation, and that in the mean time France will ever protest
against the horrid expedient which would deliver up a young and
innocent victim to the brutality of Don Miguel. I will not deny,
gentlemen, that there have been troubles in South America and in
Mexico, and that perhaps they yet exist there. Their troubles,
however, have been exaggerated. I attribute them principally to
two causes: to the threats, the impotent threats, of Spain, which
lead to the permanence of disproportioned armies and the
agitation of their leaders; the other cause is to be found in
European intriguers, who persevere in obstinately attempting to
introduce their old institutions into these new states. Put a period
to the two causes, and the tranquillity of commerce will be
immediately restored.
ā€œThe minister of commerce observed a few days since that there
was nothing in common between diplomatic relations and
commercial interests in these countries. I have, however, in my
possession a Mexican Gazette, containing a decree by which the
productions of states that shall not have recognized the republic in
the course of the present year shall be subjected to an additional
duty, whilst those which shall send, during the year 1829,
diplomatic agents to that country, shall be treated more favorably.
It is time, gentlemen, that the government should at length yield
to the commercial views of France.
ā€œAs regards Algiers, I will leave that question to one of my
honorable friends, who is better acquainted with it than myself;
but I cannot forbear referring to a more serious attack on the
national honor than that of the dey of Algiers throwing his fan. I
allude to what has passed lately relative to the expulsion of Galloti.
The delivering up of an alien for political causes has been
unanimously reprobated in every age and by every country.
Eminent jurisconsults have assured me that the laws of our
country have been violated by the expulsion of that individual. I
am willing, however, to admit that there has been, on the part of
French agents, error and precipitancy, and consequently, as I
doubt not, repentance. There has, however, been deception
somewhere, and violence has been offered to the honor of France.
Highway robbery and judgments in this case have been referred
to; but are you ignorant of what judgments are, or of what they
may be under absolute governments?
ā€œSuppose, for example, Don Miguel were to say: ā€˜Behold the
man who has in the palace of the king assassinated, with his own
hand, the Marquis of LoulƩ, the best friend of my father! Give him
up to me that I may punish him for the crime.’ Would the
accusation be believed?
ā€œIn a word, gentlemen, the honor of France has been outraged;
justice must be done; Galloti must be demanded; the demand
must be enforced; he must be restored to the soil of France, and
the national honor must in some way receive signal reparation.
ā€œI will conclude, gentlemen, by observing that the explanations
which the discussions may produce shall decide my vote.ā€
At a sitting of the Chamber of Deputies General La Fayette made
the following remarks on the ā€œHoly Allianceā€:—
ā€œThere was a vast and powerful league which desired to
command and brutalize the human species. It has oppressed Italy,
devastated the peninsula, and had disturbed other states. Its chief
seat is Vienna, and Don Miguel its ideal type. England has
pretended to set up another system, but it was only to lure states
to their ruin. It was the business of France to place herself at the
head of civilization—her glory, her interest, and her ambition to
require it; but to fulfil this noble destiny it was necessary that the
government should determine not to fear either a nation
represented or a nation armed, and, renouncing all connections, it
should say to foreign powers, ā€˜After God, it is to the French people
that I am indebted for being placed above your influence and
beyond your pretensions.ā€™ā€
During 1829 General La Fayette made a tour through some of
the French provinces, and his reception by the people appears to
have rivalled the enthusiasm displayed in his honor in the United
States. One London paper says:—
ā€œNever was a king so feasted and treated as this venerable
remnant of the Revolution has been. In every quarter he has been
received with shouts of triumph and congratulatory addresses,
which, while they have been complimentary to him, have
generally, also, been made the vehicle for strong philippics against
the new order of things. From Grenoble to Lyons the road was
thronged by continual crowds of people who came to testify their
regard for the principles which had guided his political conduct,
and the esteem which they entertained towards himself
personally.ā€ g The Times observes: ā€œThe old general, from his early
services in the cause of liberty,—from his immense sacrifices for
his country,—from his intrepid consistency of character during a
political career of forty years, during which the world turned
around him or changed its principles several times, while he
remained unchanged, is deservedly an object of great esteem and
admiration. But why is he brought forward, or why does he make
himself prominent on this occasion, type as he is of the
Revolution? And why, when he does appear, is he so
enthusiastically received? For no other reason but because the
king has made choice of what is considered a counter-
revolutionary cabinet, and because the people are desirous of
evincing their adherence to the free institutions which they think at
present threatened, by testifying their grateful admiration for one
of the founders and champions of their freedom. Every shout of
applause thus uttered for General La Fayette is a shout of defiance
against the ministers; and every libation poured to his health is a
kind offering to the memory of past struggles for liberty. The
repetition of such scenes would have been thought impossible
about two months ago.ā€
The following description of General La Fayette’s reception at
Lyons is taken from an extract of a letter dated Paris, Sept. 16,
1829:—
ā€œGeneral La Fayette has paid a visit this summer to his birthplace
in Auvergne, and has been received on his passage in a manner
worthy of his noble virtues, public as well as private. From his
arrival at Chavaniac until his entry at Lyons, in every town and
village through which he passed, he has witnessed the
spontaneous homage of the patriotism of their inhabitants. The
population of villages far distant from the road he travelled
precipitated themselves before him on his passage, and the
inhabitants of the cities through which he passed presented
themselves en masse to welcome him within their walls. In spite of
the orders sent by the ministry at Paris to the departmental
authorities, to endeavor to suppress as much as was in their power
the preparations made to receive the general, his triumphal march
since he left La Grange, from the borders of the river Manche, to
the foot of the Alps, has no other example in history, excepting his
visit to the United States. Escorted from city to city by large
cavalcades of horsemen, through arches of triumph prepared for
the occasion on the high roads, saluted continually with
enthusiasm by assembled multitudes, the thoughts of the veteran
defender of liberty were often diverted to his brilliant reception in
a distant hemisphere, whose liberties are as dear to him as those
of his native country.ā€
The PrĆ©curseur and Journal of Commerce of Lyons says:—
ā€œThe general arrived from Vienne on Friday, the 4th of
September, escorted by one hundred and fifty horsemen. His
arrival had been impatiently expected by the inhabitants of Lyons,
and on reaching St. Synphoria, the deputation named to receive
him were found waiting with a large cavalcade of horsemen and
carriages, and a numerous assemblage of people who
accompanied him to Lyons. At St. Synphoria the general
descended from his carriage and was addressed by M. Prunelle,
president of the deputation, who welcomed him on the part of the
inhabitants of Lyons to this city; to which the general replied, in
retracing the kindness with which he had been received at his last
visit to that city before the Revolution in 1789, and expressing his
gratitude for the flattering manner in which he was again received.
He then ascended into an open barouche drawn by four horses,
and conducted by two postilions, which were placed at his
disposition by the deputation, and the procession proceeded to
Lyons in the following order:—
ā€œ1st. A detachment of 400 horsemen, composed of young men
from Vienne and Lyons.
ā€œ2d. The carriage with the deputation from the latter city.
ā€œ3d. The barouche containing the general, Mr. George La
Fayette, and the president, M. Prunelle, surrounded by a cohort of
citizens on foot.
ā€œ4th. The private carriages of the general, containing the Misses
La Fayette, Mr. Adolphe Perrier, Mr. Bradford, United States consul,
and the Count de Lasteyrie.
ā€œ5th. The carriages of the committee of arrangements.
ā€œA line of private carriages then followed, and so great were
they in number, that on the arrival of the head of the procession at
the bridge Charles X. at Lyons, the last of the carriages had but
just reached the extremity of the long Faubourg de la GullotiĆØre,
nearly two miles distant. The spectacle which presented itself on
the entry of the general into the city was of the most magnificent
description. An immense population, estimated at 70,000 persons,
lined the bridge and streets through which the cortĆØge moved, and
the reiterated cries of ā€˜Vive La Fayette,’ and continued
manifestation of public joy, which filled the air during his passage
to the HƓtel du Nord, where a suite of apartments had been
prepared for him, were gratifying proofs on the part of the
enthusiastic population of Lyons, of the love and admiration for the
noble character and patriotism of their illustrious guest. In the
evening after his arrival an orchestra of one hundred and twenty
musicians serenaded under his windows, and the hotel was
surrounded until a late hour by crowds of the curious, anxious to
behold the countenance of the prisoner of Olmütz and the ardent
defender of the liberties of France.
ā€œOn the following day a splendid excursion on the river Saone,
composed of about thirty boats of various descriptions, elegantly
decorated, and some of them bearing the banners of France and
of the United States, was prepared for the general, who embarked
with his suite at twelve o’clock, greeted by the cheers of the
immense assemblage of people who lined the borders of the river.
On the arrival of the procession at the Isle Barbe, a salute was
fired from the château of the island, whence, after a short stay,
the general returned to Lyons in time to attend the dinner offered
him and Mr. George La Fayette by the different lodges of
freemasons of that city.
ā€œOn Monday the 7th inst. the grand banquet given in honor of
the general took place at the magnificent salon Gayet, situated on
the borders of the Rhone. The rooms were elegantly dressed with
festoons, and at one end were seen the portraits of Washington
and Franklin, and the bust of the distinguished guest crowned with
a wreath of laurels. On his arrival at four o’clock, he was received
with unanimous and reiterated cries of ā€˜Vive La Fayette!’ Five
hundred of the inhabitants of Lyons, the Ʃlite of that city, sat down
to a sumptuous dinner prepared for the occasion, at which
presided M. Prunelle, assisted by thirty members of the committee
of arrangements.
ā€œAt the dessert the following toasts were given:—
ā€œ1. By the president—The King of France.
ā€œ2. ā€˜General La Fayette—other warriors have been victorious in
battle, and other orators have pronounced eloquent discourses;
but none have equalled him in civic virtues.’
ā€œGeneral La Fayette then rose and said:—
ā€œā€˜You have been witnesses, gentlemen, of the marks of affection
and confidence with which the population of Lyons has deigned to
receive me within their walls; you yourselves have participated in
that kind reception in a manner so flattering, and I am surrounded
at this patriotic banquet by objects of such interesting
associations, that it would be superfluous, and above all
impossible, to express to you my feelings at this moment; the
remainder of my life, gentlemen, will be consecrated to them. I am
proud and happy that my visit here has furnished another occasion
to your city to express its constant hatred of oppression, its love
for true liberty, and its determination to resist every attempt of the
incorrigible contre-revolution.’ The general then spoke of the
privileges granted to the people by the constitution; their rights of
being tried by jury, and of elections, and of the censorship of the
press; and after having paid a just tribute to the noble and
patriotic attitude that the National Guard of Lyons took at the
important epoch of 1815, he took occasion to examine the position
of the Polignac ministry, and the violent measures which it
threatens against the liberties of France. ā€˜We are menaced,’ said
he, ā€˜by hostile projects; but how will they be effected? Will they
succeed by means of the Chamber of Deputies? My honorable
friend and colleague, M. Couderc, now at my side, and every one
of my colleagues who are now seated at this banquet, will attest
that in the moment of danger the Chamber of Deputies will show
itself faithful to patriotism and honor. Is it proposed to dissolve the
Chamber? If so, it will then be the business of the electors of
France, who certainly will return only deputies worthy of
themselves and of the nation.
ā€œā€˜Is it contemplated to vitiate the elections by more ordinances,
and thus exercise illegal power? Let the partisans of such
measures remember that the force of every government exists
only in the arms and in the purses of the individuals composing
the nation. The French nation knows its rights, and knows,
likewise, how to defend them. Let us hope, however, gentlemen,
that the plots against the liberties of the people are merely
visionary, and, in the mean time, accept from me the following
toast:—
ā€œā€˜The department of the Rhone, and the city of Lyons—the
ancient metropolis of industry, and the courageous enemy of
oppression. May its liberty, its dignity, and its prosperity be solidly
founded on the full enjoyment of those social and natural rights
which it has ever defended.ā€™ā€
One hundred thousand copies of a pamphlet, containing an
account of La Fayette’s late triumphal journey were published.
But this triumphal journey occasioned much chagrin among the
enemies of French liberty, and the government, already growing
more and more hostile to friends of liberty, took petty spite upon
some of their officials, as the following will show.
The Paris Constitutional announced that ā€œthe minister of the
interior has deposed the mayor and deputy-mayor of Vizille from
their functions: the former, for having congratulated General La
Fayette, upon his arrival in that town; and the latter, for having
appeared on horseback when he entered.ā€
Another French paper says:—
ā€œWe stated yesterday the deposition of a mayor for having
joined in the honors to La Fayette. We now add the proceedings to
which this intended disgrace gave rise. ā€˜The intelligence of this
event,’ says the PrĆ©curseur of Lyons, ā€˜inspired the inhabitants of
the commune with the greatest indignation, not being able to
conceive why peaceful citizens may not, without crime, honor one
of the worthiest public men of the nation. The whole population
assembled spontaneously in the public square; there each one
expressed his regrets, and recalled with delight the useful and
honorable acts of the displaced magistrates. Thence they
proceeded to the office of the mayor, where these functionaries
still were, and there Mr. Romain Peyron thus spoke, in the name of
his fellow-citizens:—
ā€œā€˜Mr. Mayor and Mr. Deputy: The inhabitants of this commune
have learned with the greatest pain that, by a decree of the
minister of the interior, you were deprived of the functions you
have discharged with so much zeal, and in which you have so
justly acquired the confidence and esteem of those whom you had
to serve. The motives which have afforded the new ministry a
pretext for this act are too honorable to be made a cause for
complaint! You are, gentlemen, the first citizens stripped of their
official functions for having taken part in the honors paid to
General La Fayette! Let us not envy the enemies of the public
liberties this poor satisfaction while all France is still echoing with
the acclamations which everywhere burst forth upon the passage
of this great citizen, and especially in the second city of the
kingdom!
ā€œā€˜The general who was the object of this enthusiasm will live in
history, in spite of the calumnies of party men! The people will
always recollect that he was, at that time, the zealous defender of
legal liberty, which, among us, includes attachment to
constitutional monarchy; that, on the 5th and 6th of October, he
twice saved the lives of the royal family; that, previously to the
10th of August, he sacrificed his popularity in order to snatch Louis
XVI. from the dangers that threatened him; and that, proscribed
for his energetic protest at the bar of the Legislative Assembly, and
arrested in a neutral country, he expiated, in the dungeons of
Austria, the crime of having always faithfully observed the line of
duty!
ā€œā€˜You, gentlemen, you too, fulfilled a duty, in not separating
yourselves from all these under your care, in those imposing
circumstances when the presence of our magistrates, as the
organs of our unanimous sentiments, added a new value to their
manifestation, and ensured tranquillity and good order in the midst
of our rejoicings.
ā€œā€˜Receive, therefore, the expression of our thanks and of our
regret.ā€™ā€
These testimonies of the esteem of their fellow-citizens
abundantly compensated for the vengeance of the ministers.
The prefect of the department, having designated M. Buscaillon
as provisional mayor, that respectable old man answered, ā€œthat M.
Finant having been removed by the minister of the interior for
having taken part in the honors paid to General La Fayette, he was
bound to declare that he himself had done the same thing,
together with all the other inhabitants of the commune, and that
he could not, therefore, trouble the minister to do justice upon
another in similar error.ā€
M. Buscaillon will long be remembered for his noble refusal of a
place dishonored by so gross intolerance.
CHAPTER XIV.
The Revolution of 1830—Proclamation to the French People—From
the Journal du Commerce, Paris—Proclamation of Louis Philippe
—La Fayette’s Official Announcement to the Municipality of Paris
—Order of the Day issued by General La Fayette—Details of the
Revolution—Charles X. driven from the Throne—The Deputies,
escorted by the National Guards, offer the Throne to the Duke of
Orleans—The Duke’s Reply—He is made Citizen King—Changes
in the Charter—La Fayette’s Speech in the Chamber—Letters by
La Fayette concerning this Political Upheaval—His Opinions
regarding French Affairs—Review in the Champ de Mars—Order
of the Day to the National Guards—La Fayette’s Account of the
Revolution—La Fayette’s Personal Influence in France—
Compliments of the London Press regarding him—La Fayette
speaks on Capital Punishment in the Chamber—Letter from Paris
regarding La Fayette’s Popularity—Encomiums in his Honor—
Letter from Count de Lasteyrie—Incident of the Revolution—
Resignation of La Fayette—Comments of the National Gazette—
La Fayette’s Speech on the Slave Trade—His Remarks concerning
the National Guard—La Fayette sums up the Results obtained by
the Revolution of 1830—The Victory Popular—The Dynasty of
Right Divine expelled—National Sovereignty declared—National
Guard established—Liberty of the Press secured—Trial by Jury
applied—New Electoral Law—Elective Administrations—La
Fayette receives a Deputation from Philadelphia—Address of the
American Minister—La Fayette’s Courteous and Patriotic Reply.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookultra.com
Ad

More Related Content

Similar to Microsoft Visual Basic 2008 Express Edition Build a Program Now Pelland (20)

Book HH- vb2008me preview
Book   HH- vb2008me previewBook   HH- vb2008me preview
Book HH- vb2008me preview
Satya Harish
Ā 
Visual Studio2008 Product Comparison V1.08
Visual Studio2008 Product Comparison V1.08Visual Studio2008 Product Comparison V1.08
Visual Studio2008 Product Comparison V1.08
guest1197609
Ā 
Vs2005p
Vs2005pVs2005p
Vs2005p
cm_chitta
Ā 
Microsoft system center 1
Microsoft system center 1Microsoft system center 1
Microsoft system center 1
Wael Sharba
Ā 
235042632 super-shop-ee
235042632 super-shop-ee235042632 super-shop-ee
235042632 super-shop-ee
homeworkping3
Ā 
Overview visual studio
Overview visual studioOverview visual studio
Overview visual studio
Luis Daniel Abelaira Huertos
Ā 
Tech Ed09 Net Best Practices Bijoy New
Tech Ed09 Net Best Practices Bijoy NewTech Ed09 Net Best Practices Bijoy New
Tech Ed09 Net Best Practices Bijoy New
rsnarayanan
Ā 
VS Code and Modern Development Environment Preview
VS Code and Modern Development Environment PreviewVS Code and Modern Development Environment Preview
VS Code and Modern Development Environment Preview
Roberto Stefanetti
Ā 
Sharbani bhattacharya Visual Basic
Sharbani bhattacharya Visual BasicSharbani bhattacharya Visual Basic
Sharbani bhattacharya Visual Basic
Sharbani Bhattacharya
Ā 
TechnoGeek training report
TechnoGeek training reportTechnoGeek training report
TechnoGeek training report
Anup Singh
Ā 
Visual Studio 2010 RTMtoSP1
Visual Studio 2010 RTMtoSP1Visual Studio 2010 RTMtoSP1
Visual Studio 2010 RTMtoSP1
Chalermvong Vijitpiyakul
Ā 
Visual studio-2012-product-guide
Visual studio-2012-product-guideVisual studio-2012-product-guide
Visual studio-2012-product-guide
Aravindharamanan S
Ā 
Visual studio-2012-product-guide
Visual studio-2012-product-guideVisual studio-2012-product-guide
Visual studio-2012-product-guide
Aravindharamanan S
Ā 
Visual studio-2012-product-guide
Visual studio-2012-product-guideVisual studio-2012-product-guide
Visual studio-2012-product-guide
Aravindharamanan S
Ā 
WordCampThessaloniki2011 Wordpress and Microsoft Web Platform
WordCampThessaloniki2011 Wordpress and Microsoft Web PlatformWordCampThessaloniki2011 Wordpress and Microsoft Web Platform
WordCampThessaloniki2011 Wordpress and Microsoft Web Platform
George Kanellopoulos
Ā 
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web PlatformWordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
George Kanellopoulos
Ā 
Everything You Ever Wanted To Know About Application Compatibility
Everything You Ever Wanted To Know About Application CompatibilityEverything You Ever Wanted To Know About Application Compatibility
Everything You Ever Wanted To Know About Application Compatibility
Stephen Rose
Ā 
Microsoft loves PHP. Seriously.
Microsoft loves PHP. Seriously.Microsoft loves PHP. Seriously.
Microsoft loves PHP. Seriously.
Jenna Hoffman
Ā 
Overview
OverviewOverview
Overview
ALOK RAJ
Ā 
Presentation on Visual Studio
Presentation on Visual StudioPresentation on Visual Studio
Presentation on Visual Studio
Muhammad Aqeel
Ā 
Book HH- vb2008me preview
Book   HH- vb2008me previewBook   HH- vb2008me preview
Book HH- vb2008me preview
Satya Harish
Ā 
Visual Studio2008 Product Comparison V1.08
Visual Studio2008 Product Comparison V1.08Visual Studio2008 Product Comparison V1.08
Visual Studio2008 Product Comparison V1.08
guest1197609
Ā 
Vs2005p
Vs2005pVs2005p
Vs2005p
cm_chitta
Ā 
Microsoft system center 1
Microsoft system center 1Microsoft system center 1
Microsoft system center 1
Wael Sharba
Ā 
235042632 super-shop-ee
235042632 super-shop-ee235042632 super-shop-ee
235042632 super-shop-ee
homeworkping3
Ā 
Tech Ed09 Net Best Practices Bijoy New
Tech Ed09 Net Best Practices Bijoy NewTech Ed09 Net Best Practices Bijoy New
Tech Ed09 Net Best Practices Bijoy New
rsnarayanan
Ā 
VS Code and Modern Development Environment Preview
VS Code and Modern Development Environment PreviewVS Code and Modern Development Environment Preview
VS Code and Modern Development Environment Preview
Roberto Stefanetti
Ā 
Sharbani bhattacharya Visual Basic
Sharbani bhattacharya Visual BasicSharbani bhattacharya Visual Basic
Sharbani bhattacharya Visual Basic
Sharbani Bhattacharya
Ā 
TechnoGeek training report
TechnoGeek training reportTechnoGeek training report
TechnoGeek training report
Anup Singh
Ā 
Visual studio-2012-product-guide
Visual studio-2012-product-guideVisual studio-2012-product-guide
Visual studio-2012-product-guide
Aravindharamanan S
Ā 
Visual studio-2012-product-guide
Visual studio-2012-product-guideVisual studio-2012-product-guide
Visual studio-2012-product-guide
Aravindharamanan S
Ā 
Visual studio-2012-product-guide
Visual studio-2012-product-guideVisual studio-2012-product-guide
Visual studio-2012-product-guide
Aravindharamanan S
Ā 
WordCampThessaloniki2011 Wordpress and Microsoft Web Platform
WordCampThessaloniki2011 Wordpress and Microsoft Web PlatformWordCampThessaloniki2011 Wordpress and Microsoft Web Platform
WordCampThessaloniki2011 Wordpress and Microsoft Web Platform
George Kanellopoulos
Ā 
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web PlatformWordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
George Kanellopoulos
Ā 
Everything You Ever Wanted To Know About Application Compatibility
Everything You Ever Wanted To Know About Application CompatibilityEverything You Ever Wanted To Know About Application Compatibility
Everything You Ever Wanted To Know About Application Compatibility
Stephen Rose
Ā 
Microsoft loves PHP. Seriously.
Microsoft loves PHP. Seriously.Microsoft loves PHP. Seriously.
Microsoft loves PHP. Seriously.
Jenna Hoffman
Ā 
Overview
OverviewOverview
Overview
ALOK RAJ
Ā 
Presentation on Visual Studio
Presentation on Visual StudioPresentation on Visual Studio
Presentation on Visual Studio
Muhammad Aqeel
Ā 

Recently uploaded (20)

World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
Ā 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
Ā 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
Ā 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
Ā 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
Ā 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
Ā 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
Ā 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
Ā 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
Ā 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
Ā 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
Ā 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
Ā 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
Ā 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
Ā 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
Ā 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
Ā 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
Ā 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
Ā 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
Ā 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
Ā 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
Ā 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
Ā 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
Ā 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
Ā 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
Ā 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
Ā 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
Ā 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
Ā 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
Ā 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
Ā 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
Ā 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
Ā 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
Ā 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
Ā 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
Ā 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
Ā 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
Ā 
Ad

Microsoft Visual Basic 2008 Express Edition Build a Program Now Pelland

  • 1. Visit https://ebookultra.com to download the full version and explore more ebooks Microsoft Visual Basic 2008 Express Edition Build a Program Now Pelland _____ Click the link below to download _____ https://ebookultra.com/download/microsoft-visual- basic-2008-express-edition-build-a-program-now-pelland/ Explore and download more ebooks at ebookultra.com
  • 2. Here are some suggested products you might be interested in. Click the link to download Mastering Microsoft Visual Basic 2008 Evangelos Petroutsos https://ebookultra.com/download/mastering-microsoft-visual- basic-2008-evangelos-petroutsos/ Visual Basic 2008 Programmer s Reference Rod Stephens https://ebookultra.com/download/visual-basic-2008-programmer-s- reference-rod-stephens/ Visual Basic 2008 Recipes A Problem Solution Approach 1st Edition Rakesh Rajan https://ebookultra.com/download/visual-basic-2008-recipes-a-problem- solution-approach-1st-edition-rakesh-rajan/ Programming Microsoft Visual Basic NET Version 2003 Francesco Balena https://ebookultra.com/download/programming-microsoft-visual-basic- net-version-2003-francesco-balena/
  • 3. Programming with Microsoft Visual Basic 2012 6th Edition Diane Zak https://ebookultra.com/download/programming-with-microsoft-visual- basic-2012-6th-edition-diane-zak/ Programming Microsoft SQL Server 2000 with Microsoft Visual Basic NET 1st edition Edition Rick Dobson https://ebookultra.com/download/programming-microsoft-sql- server-2000-with-microsoft-visual-basic-net-1st-edition-edition-rick- dobson/ An introduction to programming using Visual Basic 2008 with Visual Studio Expression edition DVD Schneider https://ebookultra.com/download/an-introduction-to-programming-using- visual-basic-2008-with-visual-studio-expression-edition-dvd-schneider/ Sams Teach Yourself Microsoft Visual Basic NET 2003 in 21 Days 2nd Edition Steven Holzner https://ebookultra.com/download/sams-teach-yourself-microsoft-visual- basic-net-2003-in-21-days-2nd-edition-steven-holzner/ Microsoft Visual Basic Programs to Accompany Programming Logic and Design 3rd Edition Jo Ann Smith https://ebookultra.com/download/microsoft-visual-basic-programs-to- accompany-programming-logic-and-design-3rd-edition-jo-ann-smith/
  • 5. Microsoft Visual Basic 2008 Express Edition Build a Program Now Pelland Digital Instant Download Author(s): Pelland, Patrice ISBN(s): 9788120335042, 0735625417 Edition: PAP/CDR File Details: PDF, 7.29 MB Year: 2008 Language: english
  • 7. PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright Ā© 2008 by Microsoft Corporation All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Control Number: 2008920560 Printed and bound in the United States of America. 1 2 3 4 5 6 7 8 9 QWT 3 2 1 0 9 8 Distributed in Canada by H.B. Fenn and Company Ltd. A CIP catalogue record for this book is available from the British Library. Microsoft Press books are available through booksellers and distributors worldwide. For further information about international editions, contact your local Microsoft Corporation office or contact Microsoft Press International directly at fax (425) 936-7329. Visit our Web site at www.microsoft.com/mspress. Send comments to [email protected]. Microsoft, Microsoft Press, DirectX, Excel, Expression, Expression Blend, IntelliSense, Internet Explorer, Jscript, MSDN, MSN, Outlook, Silverlight, SQL Server, Visual Basic, Visual C#, Visual C++, Visual Studio, Visual Web Developer, Win32, Windows, Windows Live, Windows Mobile, Windows Server, Windows Vista, Xbox and Xbox 360 are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners. The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. This book expresses the author’s views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Acquisitions Editor: Ben Ryan Developmental Editor: Sandra Haynes Project Manager: John Pierce Editorial Production: Happenstance Type O Rama Technical Reviewer: Richard Triance Body Part No. X14-55519
  • 8. iii Contents iii Chapter 1 Introducing Microsoft Visual Basic 2008 Express Edition 1 What Is .NET? 2 What Is Visual Basic 2008? 4 Is Visual Basic 2008 an Object-Oriented Programming Language? 4 What Is Visual Basic 2008 Express Edition? 9 What Kinds of Applications Can You Build with Visual Basic 2008 Express Edition? 10 What Are the Key Features You Need to Know About? 11 Chapter 2 Installing Visual Basic 2008 Express Edition 15 Preparing to Install Visual Basic 2008 Express Edition 16 Side-by-Side Installation 16 Prerelease Versions of Visual Basic 2008 Express Edition 17 Installing Visual Basic 2008 Express Edition 17 Chapter 3 Creating Your First Applications 25 Three Types of Applications: What Are the Differences? 26 Getting Started with the IDE 28 Building the Projects 31 Building a Console Application 31 Getting to Know Solution Explorer 32 Getting Help: Microsoft Visual Studio 2008 Express Edition Documentation 34 Coding Your Console Application 37 Customizing the IDE 39 Creating a Windows Application 41 Chapter 4 Creating Your Own Web Browser in Less Than Five Minutes 47 What Is a Project? 48 What Is the Design Layout? 49 To Create a Simple Web Browser 50 Putting It All Together 56 Chapter 5 Using Rapid Application Development Tools with Visual Basic 2008 59 Snapping and Aligning Controls Using Snap Lines 60 Using IntelliSense—Your New Best Friend! 62 Using IntelliSense as You Go 62 Using IntelliSense Filtering: Removing the ā€œUncommonā€ 63 Opening IntelliSense: Pressing Ctrl+Spacebar 64 Opening IntelliSense: Typing a Period or Left Parenthesis 64 Using IntelliSense Code Snippets: The Time-Saver 66 Invoking IntelliSense Code Snippets 67 Exploring Real-Time Error Detection and Correction 68 Oh, My...My Is Great 70 Contents
  • 9. iv Microsoft Visual Basic 2008 Express Edition: Build a Program Now! Renaming 72 Why Should You Rename? 73 How to Use the Rename Feature 73 Exploring Common Windows Controls 75 What Happens When an Event Is Triggered? 78 Chapter 6 Modifying Your Web Browser 85 Opening Your Application 86 Interacting Through Dialog Boxes 93 Adding an About Dialog Box 93 Adding a Navigate Dialog Box 96 Having a Professional Look and Feel at Your Fingertips 99 Adding a Tool Strip Container and Some Tools 99 Adding a Status Bar to Your Browser 101 Personalizing Your Application with Windows Icons 104 Redoing the Browser 112 Windows Presentation Foundation 112 WPF and XAML 113 Chapter 7 Fixing the Broken Blocks 125 Debugging an Application 126 Using a DLL in an Application 126 Using Breakpoints, Locals, Edit and Continue, and Visualizers 128 Chapter 8 Managing the Data 141 What Is a Database? 142 What’s in a Database? 142 What Are Data Normalization and Data Integrity? 143 What Is Null? 145 What Are Primary Keys and Foreign Keys? 146 How Do You Interact with a Relational Database? 148 Using SQL Server 2005 Express Edition in Visual Basic 2008 Express Edition 150 Creating a Database Using Visual Basic 2008 Express Edition 151 Creating Tables in Your Database 153 Creating Relationships Between the Tables 155 Entering Data in SQL Server Tables Using Visual Studio 159 What Are ADO.NET, Data Binding, and LINQ? 163 Developing the CarTracker Application 165 Using the Component Tray 172 How Do I Get More Meaningful Information on My Form? 173 Using LINQ 182 Chapter 9 Building Your Own Weather Tracker Application 187 Exploring the Features of the Weather Tracker Application 188 Creating the Application User Interface 189 Adding Notification Area Capabilities 191 Adding the Splash Screen and About Dialog Box 199 Adding the Options Dialog Box 202 Using the MSN Weather Web Service 204 Connecting to MSN Weather Web Services 206 Setting User and Application Preferences 210 Working in the Background 211 Completing the Core Weather Tracker Functionality 219 Testing Weather Tracker 225 Working with the Options Dialog Box 226 Testing Weather Tracker Options 229 And Now, Just ClickOnce 229 Glossary 235 Index 237
  • 10. v Introduction Microsoft Visual Basic 2008 Express Edition (and the other Visual Studio 2008 Express Edition products) is, in my opinion, one of the best and most intelligent ideas to come from the Developer Division at Microsoft. I’m applauding and cheering for the people who had this brilliant idea because I believe there is a real need and demand for a world-class, powerful product for hobbyist programmers, students, and professional developers. And Visual Basic 2008 Express Edition provides all of that and more. Visual Basic 2008 Express Edition is a fully functional subset of Visual Studio 2008, suitable for creating and maintaining Windows applications and libraries. It’s not a timed-bomb edition, a demo, or a feature-limited version—no, it’s a key Microsoft initiative to reach more people and give them the ability to have fun while creating cool software. Who Is This Book For? This book is for everybody: students, hobbyist pro- grammers, and people who always thought programming was a tough task. It’s for people who have ideas like ā€œI wish I could build a tool to store all my recipes and then print them and send them to my friends,ā€ ā€œI wish I could build this cool card game that I have never found elsewhere,ā€ ā€œI wish I could build this cool software to store my DVD and CD collection,ā€ ā€œI wish I could build this software to help me work with matrices and plot graphics for my math class,ā€ and many more projects that you can imagine! This book is for people who have ideas but don’t know how to bring them to reality. And it’s a good introduction to the art and science of developing software. How This Book Is Organized This book consists of nine chapters, each covering a particular feature or technology about Visual Basic 2008 Express Edition. Most chapters build on previous chapters, so you should plan on reading the material sequentially. Conventions and Features in This Book This book presents information using conventions designed to make the information readable and easy to follow. Before you start the book, read the following list, which explains conventions you’ll see throughout the book and points out helpful features in the book that you might want to use: Each exercise is a series of tasks. Each task is presented ā–  as a series of numbered steps (step 1, 2, and so on). Each exercise is preceded by a procedural heading that lets you know what you will accomplish in the exercise. Introduction v
  • 11. vi Microsoft Visual Basic 2008 Express Edition: Build a Program Now! Boxes labeled ā–  TIP, NOTE, MORE INFO, and so on, pro- vide additional information or alternative methods for completing a step successfully. Boxes labeled ā–  CAUTION alert you to information you need to verify before continuing. Text that you type appears in bold. ā–  Menu commands, dialog box titles, and other user ā–  interface elements appear with each word capitalized, such as in ā€œclick Save As.ā€ A plus sign (+) between two key names means that you ā–  must press those keys at the same time. For example, ā€œPress Alt+Tabā€ means that you hold down the Alt key while you press the Tab key. Code listings appear in a monospaced font in this book. ā–  Sidebars throughout the book provide more in-depth ā–  information about the content. The sidebars might con- tain background information, design tips, or features related to the information being discussed. Each chapter ends with an ā€œIn Summaryā€¦ā€ section that ā–  briefly reviews what you learned in the current chapter and previews what the next chapter will present. System Requirements You’ll need the following hardware and software to complete the exercises in this book: Windows Vista, Microsoft Windows XP with Service ā–  Pack 2, or Microsoft Windows Server 2003 with Service Pack 2 Visual Basic 2008 Express Edition ā–  1 GHz 32-bit (x86) processor ā–  1 GB MB RAM (512 MB minimum) ā–  40 GB hard drive with at least 15 GB of available space ā–  Support for Super VGA graphics (for support for ā–  DirectX 9 graphics, see the recommended requirements at www.microsoft.com/windows/products/windowsvista/ editions/systemrequirements.mspx) CD-ROM or DVD-ROM drive ā–  Microsoft mouse or compatible pointing device ā–  You’ll also need administrator access to your computer to configure SQL Server 2005 Express Edition. Code Samples You can download the code samples for the examples in this book from the book’s companion content page at the following address: http://www.microsoft.com/mspress/ companion/9780735625419/. You’ll use the code samples and starter solutions as you perform the exercises in the book. By using the code samples, you won’t waste time cre- ating files that aren’t relevant to the exercise. The files and step-by-step instructions also let you learn by doing, which is an effective way to acquire and remember new skills. You’ll also find the complete solutions if you want to verify your work or simply want to look at them. N O T E The companion DVD contains the Visual Basic 2008 Express Edition soft- ware needed to complete the exercises in this book. The DVD also includes the other Visual Studio 2008 Express Editions—for Visual C#, Visual C++, and Web development. You can install any of the Express Edition products included on the DVD. See Chapter 2, ā€œInstalling Visual Basic 2008 Express Edition,ā€ for detailed installation instructions.
  • 12. vii Introduction vii 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/9780735625419/. 2. After you download the code samples file, run the installer. 3. Follow the instructions that appear. The code samples are installed in the Documents Microsoft PressVB 2008 Express folder on your computer. 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 in the following table. 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.ā€ Project Description Chapters 1 and 2 No sample projects. Chapter 3 MyFirstConsoleApplication MyFirstWindowsApplication Application that takes two numbers, adds them together, and then displays the sum in a console window. Same application as MyFirstConsoleApplication, but this one 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 teaches you to use the most important features in Visual Basic 2008 Express Edition. Chapter 6 MyOwnBrowser This is the same application you developed in Chapter 4, enhanced with additional features. You’ll add menus, toolbars, status and progress bars, and a navigation win- dow with autocomplete. You’ll also build a simple browser using Windows Presentation Foundation (WPF).
  • 13. viii Microsoft Visual Basic 2008 Express Edition: Build a Program Now! Uninstalling the Code Samples Follow these steps to remove the code samples from your computer. ON WINDOWS VISTA 1. In Control Panel, click Programs. 2. Under Programs and Features, click Uninstall a Program. 3. In the list of programs, select Microsoft Visual Basic 2008 Express Edition: Build a Program Now!, and then click Uninstall. 4. Follow the instructions on the screen to remove the code samples. ON WINDOWS XP 1. In Control Panel, open Add or Remove Programs. 2. From the Currently Installed Programs list, select Micro- soft Visual Basic 2008 Express Edition: Build a Program Now!, and click Remove. 3. Follow the instructions on the screen to remove the code samples. Prerelease Software This book was reviewed and tested against the Novem- ber 2007 release candidate for Visual Studio 2008. This book is expected to be fully compatible with the final release of Visual Studio 2008. If there are any changes or corrections for this book, they’ll be collected and added to a Microsoft Knowledge Base article. See the ā€œSupport for This Bookā€ section later in this introduction for more information. Technology Updates As technologies related to this book are updated, links to additional information will be added to the Microsoft Project Description Chapter 7 Debugger An application full of problems to help you learn how to debug an application by using features of Visual Basic 2008 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. You’ll also be introduced to Language Integrated Query (LINQ). Chapter 9 Weather Tracker An application that runs in the system tray and has a nice user interface to display weather data collected by your application from the MSN Weather service. You’ll also create a deployment package for the distribution of your application.
  • 14. ix Introduction ix Press Technology Updates Web page (http://www.micro- soft.com/mspress/updates/). Visit this page periodically for updates on Visual Studio 2008 and other technologies. Support for This Book Every effort has been made to ensure the accuracy of this book and the companion content. As corrections or changes are collected, they’ll be added to a Microsoft Knowledge Base article. To view the list of known correc- tions for this book, visit http://support.microsoft.com/, and in the Search box, enter the book title. Microsoft Press provides support for books and com- panion content at http://www.microsoft.com/learning/ support/books/. Questions and Comments If you have comments, questions, or ideas regarding the book or the companion content or have questions that are not answered by visiting the sites listed earlier, please send them to Microsoft Press via e-mail to mspinput@ microsoft.com. Or you can send them via postal mail to the following address: Microsoft Press Attn: Visual Basic 2008 Express Edition: Build a Program Now! Editor One Microsoft Way Redmond, WA 98052-6399 Please note that Microsoft offers no software product support through these addresses. About the Author Patrice Pelland is a development manager at Microsoft working in the Online Services Group. He has a passion for Web 2.0 technologies, Silverlight, WCF, and ASP.NET. For the past four years, he has been working, teaching, evange- lizing, and talking about these technologies to everyone. For the past 14 years, he has been working in software development in various roles: developer, project lead, manager and mentor, and software engineer in QA orga- nizations. He has vast experience spanning multiple tech- nologies and fields, including Web development, developer tools, fiber optics telecommunication, aviation, and coffee and dairy companies. He also spent three years teaching computer science and software development at a college in Canada. When not developing great tools for developers and helping customers throughout the world, he enjoys spend- ing time with his family and friends, playing games on Xbox 360 and his PC, reading books, reading about cars, playing hockey, watching NHL hockey and NFL football, and having great dinners with good food and fine drinks with friends and family. He resides with his family in Sammamish, Wash- ington. Dedication This book is dedicated to my family. My wife, HĆ©lĆØne, is my strength; because of her love and her respect, I am a better human being. She’s beautiful—my idol, my inspira- tion, my sunshine, my best friend, my love, and an awe- some mother! Mon amour, thanks for being who you are
  • 15. x Microsoft Visual Basic 2008 Express Edition: Build a Program Now! and for being there for me. I love you! Thanks to her for letting me repeat this crazy adventure of writing a book. Thanks First of all, thanks to my parents. Mom and Dad, you gave me all the chances to be what I am in life and you gave me the values to be the man I am. Thanks, and I love you! A book is a huge adventure in somebody’s life (imag- ine two ☺), and it would not be possible without the help of many people. I’ve always read the ā€œthank youā€ sections in other people’s books, and I was always amazed at how many people are needed to make a book what it is. Now I really understand why! Although writing a book is tough—real tough—it’s really satisfying at the same time. During the writing pro- cess, you sometimes have doubts, and I had my share of them, especially those nights at 3 a.m. when all other souls in the house were asleep, even my dog; when I was in front of my laptop with an exception and a white page in Micro- soft Word. I can’t remember how many times I said to my friends, ā€œNo, I won’t be able to be there. I need to work on my book.ā€ But it’s an awesome experience to write a book; everybody who has the chance should take the challenge! That said, I first need to thank my lovely family for letting me do this to them again. My kids (Laura, 13, and Antoine, 11) and my wife, HĆ©lĆØne, were so great and patient. This time they said, ā€œYou’re writing another book! Oh, no…we’ll see you after Thanksgiving.ā€ But at the same time, they were respecting the space I needed and the time alone! You guys are great, and I love you! I have to thank all the people at Microsoft Learning and the publishing team. I would especially like to thank Ben Ryan for offering me the chance to work with him again; Sandra for her constant motivation, help, and suggestions and also for helping me through all the hurdles of writing a book; and all the folks on the publishing team for all their help getting the job done and producing a real, tangible product. You guys have my respect for working day in, day out in the crazy world of publishing. I would also like to thank all the people in the Visual Basic, C#, Windows Forms, MSDN, and setup teams who helped me by answering all my questions in a dynamic and constantly changing product life cycle. I would like to thank more specifically Dan Fernandez, Joe Binder, Brian Keller, Brian Johnson, Hong Gao, Jay Roxe, Kavitha Radhakrishnan, Kent Sharkey, Lisa Feigenbaum, Shamez Rajan, Steve Lasker, Aaron Stebner, and Habib Heydarian. Thanks also to my colleagues at MSN for always giv- ing me good words of encouragement and to my friends Pascal, Simon, Nicolas, John, and Patrice for reviewing the samples and some chapters. Thanks to my good friends here in the Puget Sound area for the kind words of encouragement and to my fam- ily and friends in Canada for understanding why I’m not calling or giving any news. Sorry, Mom and Dad! Thanks to everybody I might have forgotten! Patrice Pelland November 2007 Sammamish, WA
  • 16. 1 1 What Is .NET?, 2 What Is Visual Basic 2008?, 4 Is Visual Basic 2008 an Object-Oriented Programming Language?, 4 What Is Visual Basic 2008 Express Edition?, 9 Chapter 1 Introducing Microsoft Visual Basic 2008 Express Edition Maybe you’ve decided to try programming and find yourself with this book. If that’s the case, you’ve come to the right place. This book is all about introducing you to the art, science, and joys of creating software for Micro- soft Windows—yes, the same Microsoft Windows you probably use every day. Throughout the book, I’ll show you how to build applications that are similar to many of the applications you use on a regular basis, such as your Internet browser, your word processor, your e-mail software, and your per- sonal finance application. You’re probably wondering how you could pos- sibly do this with no programming experience. Don’t worry. By the time you finish this book, you’ll be a believer. We’ll have a blast, and because you’ll actually be building applications as you follow along with each exercise, you’ll see for yourself just how easy it can be.
  • 17. 2 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! What is this .NET thing everybody is talking about? Maybe you’ve seen the term some- where online or have come across it in the jobs section of your Sunday newspaper. A good analogy is that .NET—also called the .NET Framework—is to a software developer what tools and manuals are to an auto mechanic. Here is a formal definition of the .NET Framework: The .NET Framework is a platform with which you can develop software applications and libraries called managed applications; it provides you with the compiler and tools you need to build, debug, and execute managed applications. For our purposes, you could say that .NET is the platform that gives you everything you need to develop and run managed applications that run on Windows. We say that applications are managed because their execution is managed by the .NET Framework. In fact, the .NET Framework manages the execution by providing a controlled runtime environment that offers a wide variety of services, such as loading your applications, managing memory, and monitoring and maintaining security and integrity while the applica- tion runs. Before .NET (and Java), applications were unmanaged because they were not executed by a controlled runtime environment. No other component of the operating system provides the services .NET offers. The applications had to manage their own services, which sometimes led to erroneous code, security holes, and data corruption. Because of these problems, applications were tough to maintain and debug. The .NET Framework provides you with a wide variety of tools, such as compilers, debug- gers, programming languages, an execution engine (named the Common Language Runtime [CLR]), developer tools, and a large number of predefined ā€œbuilding blockā€ libraries. These libraries are named Framework Class Libraries (FCLs). You can think of each .NET component as a building block in a house and each version of .NET as an insulation layer in the walls of a house. Figure 1-1 illustrates how many versions of .NET are on the market, as well as what components have been added and in which version they belong. What Is .NET? N O T E Throughout this book, I’ll use the terms framework and .NET Framework synonymously.
  • 18. Chapter 1: Introducing Microsoft Visual Basic 2008 Express Edition 3 NET 2. 0 NET 3.0 NET 3.5 WCF WF WPF CardSpace LINQ AJAX REST CLR WinForms Web Services ASP.NET Visual Studio 2008 Figure 1-1 Additive versions of the .NET Framework Some of these building blocks ship with the Windows Vista operating system. Two popular ones are Windows Presentation Foundation (WPF) and Windows Communication Foundation (WCF). WPF is a library that helps you build richer user interfaces and Windows Vista–like applications for Windows. WCF, as its name implies, is a library that helps two applications talk to each other using messages. To understand the relationship between .NET 3.0 and .NET 3.5, remember that .NET 3.0 comes with Windows Vista and .NET 3.5 comes with Visual Studio 2008. Language Integrated Query (LINQ), which simplifies writing code that manipulates data from various data sources (SQL Server databases, XML files, and so on), is one of the features in .NET 3.5 that we’ll cover in this book. N O T E What do the other abbreviations and names in Figure 1-1 mean? WF is the Windows Workflow Foundation, another building block that developers can use to help automate business processes through programs. CardSpace is a technology related to manag- ing online identities—something like using a credit card. AJAX (Asynchronous JavaScript And XML) is used to develop Web applications, and REST (Representational State Transfer) is a programming architecture used for transferring data on the Web.
  • 19. 4 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! I won’t put you to sleep with all the definitions for each building block. We’re going to use or talk about most of them in our projects in this book, and I’ll introduce the blocks when appropriate. Just consider Figure 1-1 and return to it when you need to do so. Two notes about this figure are worth mentioning. First, look at the blue component on top of the concentric circles. Microsoft Visual Studio 2008 is not part of the .NET Framework, but it touches the .NET Framework at all levels. With Visual Studio 2008, you can develop applications that take advantage of all the components of the .NET Framework. Second, notice that the CLR, among other components, is at the center of the circles. The CLR is a crucial part of the foundation because it’s the engine that loads and manages the execution of source code. Visual Basic 2008 is one of the programming languages that target the .NET Framework. Like any spoken or written language, Visual Basic has syntax rules and a series of valid words you can use to create your applications. Visual Basic is a popular choice for beginners because some people find the syntax simpler than the syntax of many other programming languages. If you have used an older version of Visual Basic (such as Visual Basic 4.0, 5.0, or 6.0), you’ll find some familiar constructs and a familiar user interface (UI) in Visual Basic 2008. Visual Basic 2008 is a fully fledged object-oriented programming language. Let’s talk about what this means. I M P O R TA N T It’s not necessary to have Visual Studio to develop .NET applications, but using it offers many advantages, as you’ll see in this book. I M P O R TA N T The CLR hasn’t changed in Windows Vista and Visual Studio 2008; the CLR that is run- ning on all operating systems is .NET 2.0. What Is Visual Basic 2008? Is Visual Basic 2008 an Object-Oriented Programming Language?
  • 20. Chapter 1: Introducing Microsoft Visual Basic 2008 Express Edition 5 Object-oriented programming (OOP) is a programming style (or programming para- digm). There are other programming paradigms, such as functional or procedural program- ming. Languages such as C, Fortran, Pascal, and previous versions of Visual Basic all use functional or procedural programming paradigms. These paradigms focus more on the actions, while OOP focuses more on the data itself. Applications that use the OOP paradigm are developed using OOP languages (OOPLs). The first OOPLs were introduced in the late 1960s, but they really became popular in the late 1970s. They are widely used today because most people agree that they’re easy to learn, use, debug, and maintain. For instance, OOPLs easily represent real-world objects. Visual Basic 2008 is an OOPL as are C#, C++, Java, Smalltalk, Lisp, and others. Programmers use OOP to write programs that represent the decomposition of real- world problems into modules. Those modules represent real-world objects and are known as classes or types. You can think of an OOP program as a collection of objects interacting with each other. Using OOP, a programmer defines new types to represent real-world objects, such as a plane, a person, a customer, a dog, or a car. Those types or classes have what are known as constructors, which developers use to create objects or instances. An object in a program is a unit that represents one instance of a real-world object. It’s a self-contained unit because it includes all the data and functionality associated with that object. This means each object created in an application contains all the information that characterizes it (data members or fields) and all the actions (methods) that can access or modify that information. Here is a simple example in Visual Basic 2008 that defines a Person class: 1 Public Class Person 2 ā€˜Data members 3 Private Name As String 4 Private Address As String 5 Private City As String 6 Private State As String 7 Private ZIP As String 8 Private Country As String 9 10 ā€˜Methods 11 Overridable Sub Display() 12 Console.WriteLine(Name) 13 Console.WriteLine(Address) 14 Console.WriteLine(City) M O R E I N F O With C++ you can develop proce- dural applications, pure object- oriented applications, or a mix of both.
  • 21. 6 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! 15 Console.WriteLine(State) 16 Console.WriteLine(ZIP) 17 Console.WriteLine(Country) 18 End Sub 19 End Class This class includes private data members and a Display method to print the object’s content to the console. The Sub method is by default public. The Overridable keyword means that a new class derived from this class will be able to write its own implementation of the Display method. Let’s use a different example to go over these concepts some more. My dog, Chopin, is an instance of the class Dog, and the class Dog is a subclass of the Animal class. Because Chopin is a dog, he has some behaviors and data that are proper for a dog. But because a dog is also an animal, Chopin also inherits some data and behaviors from the Animal class. This means that the instance Chopin of the class Dog has data members that character- ize him and methods that I can call on that little furry ball. For example, here is the instance information for the Chopin object: Data Breed ā–  He’s a Maltese. Gender ā–  He’s male. Weight ā–  His weight is 5.5 pounds (2.5 kilograms). Color ā–  He’s white. Name ā–  His name is Chopin Chabispel. Age ā–  He’s three years old. Actions He speaks (barks). ā–  He eats. ā–  He moves. ā–  He sleeps. ā–  M O R E I N F O In the example of the Person class, you would need to imple- ment properties to access or modify the Private fields from outside the class. These types of fields hide data in your class.
  • 22. Chapter 1: Introducing Microsoft Visual Basic 2008 Express Edition 7 All these data items (breed, gender, weight, color, name, and age) and actions (speak, eat, move, and sleep) characterize him, but they can also characterize any other dog, such as my neighbor’s dog, Molly. And if you think about it, those items can characterize any animal. This means that the class Dog inherits data members and methods from the class Animal. Let’s say you want to develop an application for a veterinary clinic. To cover the cats who come to your clinic, all you must do is create a Cat class that also inherits from the class Animal. Then each class (Cat and Dog) could override functionality in the Animal class as needed. For instance, for the Cat class the Speak method would be meows instead of barks. This means that those Speak methods for Cat and Dog are specializations of the regular animal Speak method. Let’s look at the Person class example again. This time, I’ll also show an Employee class that derives from the Person class. The Employee class derives from the Person class by using the keyword Inherits followed by the Person element. The keyword Overrides changes the implementation of the Display method. 20 Public Class Employee 21 Inherits Person 22 23 Public Level As Integer 24 Public Salary As Integer 25 26 Overrides Sub Display() 27 Console.WriteLine(Name + ā€œ is at level ā€œ + Level.ToString() + ā€œ and has a salary of : ā€œ + Salary.ToString() + ā€œ$ā€) 28 Console.WriteLine(ā€œHis address is:ā€) 29 Console.WriteLine(Address) 30 Console.WriteLine(City + ā€œ,ā€ + State + ā€œ ā€œ + ZIP) 31 Console.WriteLine(Country) 32 End Sub 33 End Class In this case, the Employee class inherits from the Person class and therefore gets all the data fields from that base class. The Employee class doesn’t have to redefine any of the fields in its definition because it gets them automatically from Person. So, for the Employee class, you must specify only what is different from an instance of the Person class. For example, an instance of the Employee class would have Level and Salary, whereas none of the instances T I P In this book, you’ll notice that some code listings include line numbers. If a line does not include a number, it indicates that the code is a continuation from the previous line. Some code lines can get rather long and must be wrapped to be displayed on the printed page. If you need to type the code in Visual Basic, be sure to put continued lines on a single line.
  • 23. 8 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! of the Person class would. The Display method for Employee could thus add level and salary information to the displayed message when it is called. This was just a brief introduction to OOP and some of its concepts. Visual Basic 2008 supports all of these concepts and many more. Throughout this book you’ll see more OOP concepts, and when you do, I’ll highlight them in a ā€œreader aidā€ information box, as shown in the left margin. Here’s the complete listing used in this section with the addition of the Customer class: 34 Imports System 35 36 Public Class Person 37 ā€˜Data members 38 Public Name As String 39 Public Address As String 40 Public City As String 41 Public State As String 42 Public ZIP As String 43 Public Country As String 44 45 ā€˜ Methods 46 Overridable Sub Display() 47 Console.WriteLine(Name) 48 Console.WriteLine(Address) 49 Console.WriteLine(City) 50 Console.WriteLine(State) 51 Console.WriteLine(ZIP) 52 Console.WriteLine(Country) 53 End Sub 54 End Class 55 56 Public Class Customer 57 Inherits Person 58 59 Public ID As Integer 60 Public IsPartner As Boolean 61 62 Overrides Sub Display() 63 Dim partnerMessage As String 64 65 If IsPartner Then 66 partnerMessage = ā€œ is a partnerā€ N O T E In .NET, all classes ultimately derive from the Object class, even when it is not specified.
  • 24. Chapter 1: Introducing Microsoft Visual Basic 2008 Express Edition 9 67 Else 68 partnerMessage = ā€œ is not a partnerā€ 69 End If 70 71 Console.WriteLine(ā€œCustomer ID: ā€œ + ID.ToString()) 72 Console.WriteLine(Name + partnerMessage) 73 Console.WriteLine(Address) 74 Console.WriteLine(City + ā€œ,ā€ + State + ā€œ ā€œ + ZIP) 75 Console.WriteLine(Country) 76 End Sub 77 End Class 78 79 Public Class Employee 80 Inherits Person 81 82 Public Level As Integer 83 Public Salary As Integer 84 85 Overrides Sub Display() 86 Console.WriteLine(Name + ā€œ is at level ā€œ + Level.ToString() + ā€œ and has a salary of : ā€œ + Salary.ToString() + ā€œ$ā€) 87 Console.WriteLine(ā€œHis address is:ā€) 88 Console.WriteLine(Address) 89 Console.WriteLine(City + ā€œ,ā€ + State + ā€œ ā€œ + ZIP) 90 Console.WriteLine(Country) 91 End Sub 92 End Class This is a simple case, but it illustrates some of the basic concepts of OOP. What Is Visual Basic 2008 Express Edition? Visual Basic 2008 Express Edition is the tool we will use throughout this book to develop applications that run on Windows. The Express editions of Visual Studio 2008 were designed
  • 25. 10 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! to focus on productivity. As with the high-end versions of Visual Studio 2008, the Express editions are also what we call rapid application development (RAD) tools because their phi- losophy is geared toward productivity. The Express editions of Visual Studio are easy to use, easy to learn, and streamlined because although they contain mostly the same components, they lack the full breadth of features found in the higher-end versions of Visual Studio. Most features and components in the Express editions were simplified to make the learning curve less steep and to fit the needs of the nonprofessional developer. The Visual Studio 2008 Express editions were designed with beginner programmers in mind—people like you who are curious about programming and who are looking for an easy way to build Windows applications while learning how to program. Visual Basic 2008 Express Edition is the ideal tool to use to rapidly develop applications for topics you really love or for hobbies you enjoy. You can also use it to help ease your day-to-day job or school tasks. Most important, you can have fun with the tool while you’re learning to program. What Kinds of Applications Can You Build with Visual Basic 2008 Express Edition? With this version of Visual Studio 2008, you’ll be able to create the following types of applications: Windows applications ā–  These are applications that have a graphical interface with buttons, windows, menus, toolbars, and so on, as in Microsoft Word or Windows Internet Explorer. With this book you’ll be able to take full advantage of WPF, which lets you build applications that create a rich user experience while exploiting all the power of your com- puter. You can also build applications that look like Windows Vista–based applications. Console applications ā–  These are applications that have no graphical interface and that simply use text to communicate with the user. (Typically, these applications run in a com- mand window or DOS window.) Reusable components or class libraries ā–  These are groups of tools created to help build other applications. What you won’t be able to build are Web sites and Web services. To create any type of Web application, you will need to get Microsoft Visual Web Developer 2008 Express Edition. N O T E We will look into the details of what types of applications fall into these categories in Chapter 3, ā€œCreating Your First Applications.ā€
  • 26. Chapter 1: Introducing Microsoft Visual Basic 2008 Express Edition 11 What Are the Key Features You Need to Know About? The following list, although not complete, provides the essential features of Visual Basic 2008 Express Edition. At this point, don’t worry if you don’t understand every feature listed. I’m presenting the features in the list because you’ll come across all of them in some way in the fun sample applications you will be creating as you read this book. Most of the features listed here emphasize the RAD philosophy. Although the idea is to give you an overview of the interesting features that can make your life easier, the names of the features alone are not sufficient to understand what they mean. I’ve included a brief description giving you the essentials and explaining how they will help you develop applica- tions. Built-in Starter Kits ā–  The Starter Kits are fully developed applications with best practices and examples to follow. These applications will give you another example on which to base your learning. They will be a good complement to what we are doing in this book. You can find them at http://msdn2.microsoft.com/en-us/vbasic/ms789080.aspx. Beginner’s targeted documentation and tutorials ā–  These are a fast and easy way to get information. They also provide samples. IntelliSense ā–  This feature provides real-time syntax suggestions and even finishes your typing for you. In Visual Studio 2008, IntelliSense, as you will see, is everywhere (it’s now called IntelliSense Everywhere), and it provides a more complete and contextual set of suggestions. Code snippets ā–  Snippets provide code for more than 200 programming tasks to help you complete many common tasks automatically. In addition, code snippets show the recommended way of performing a task. They are directly integrated into the develop- ment environment, and they are extensible; that is, anybody can extend the existing snip- pets or provide new ones. Over time Microsoft will continue to supply new code snippets, and members of online communities will contribute their snippets as well. Code snippet extensibility seems to be a really nice feature that will help people share useful features in online communities. My ā–  construct This new Visual Basic feature provides simple access to popular .NET Framework classes and common tasks. With it you can perform tasks without knowing
  • 27. 12 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! all the framework internals. These tasks are nicely wrapped and provide you with an easy and clean way of getting things done. Although similar to code snippets, the My con- struct elements have their source code hidden and wrapped in one line of code. Data-enabled applications ā–  With these applications you can connect to Microsoft SQL Server 2005 Express Edition and add databases and code to access the data in your appli- cations. In addition, a new editor has been added to help you develop applications that use data. As mentioned earlier, LINQ is one of the big new features of .NET 3.5 included with Visual Studio 2008, and you’ll see how to use it in Chapter 8, ā€œManaging the Data.ā€ Windows Forms Designer and WPF Designer ā–  With these new tools, you can easily design your Windows application using either Windows Forms or WPF, including features such as snap lines, which make sure your controls are aligned in your form, and autocor- rect, which gives you real-time compiler feedback. You won’t have to compile your code to know whether you have errors; Visual Basic 2008 will show them to you as you type and even give you potential fixes. XAML Editor ā–  The XAML Editor lets you edit Extensible Application Markup Language (XAML), which was introduced with .NET 3.0. This new markup language is used exten- sively in WPF and Windows Workflow (WF) to describe user interface elements in WPF and process logic in WF. (WF is beyond the scope of this book.) XML Web services ā–  Visual Basic 2008 provides easy-to-use tools and wizards that will help you connect to published XML-based Web services and will help you utilize their functionality. New Windows Forms controls ā–  These comprise an impressive list of controls—a greater selection than in any previous version of Visual Basic. They will help you create user interfaces that have a professional look and feel. Smart Tags ā–  Most Windows Forms controls that come with the product include Smart Tags. As in many applications of the 2007 Microsoft Office system, a Smart Tag is rep- resented by a little black triangle, or an icon and a little black triangle, attached to a control. A Smart Tag gives you access to the most common actions you can perform on a control. M O R E I N F O XAML is also used in Silverlight for Web applications, but this is beyond the scope of this book.
  • 28. Chapter 1: Introducing Microsoft Visual Basic 2008 Express Edition 13 ClickOnce deployment ā–  With this feature you can easily publish your applications on the Internet, on a local area network (LAN), on a network share, or on a CD. It also simpli- fies publishing updates. In this new edition of Visual Studio, you can now use a wizard to handle the Windows Vista User Account Control (UAC) so that your application runs in the lowest user security context it needs. Usually you want to aim your software develop- ment on Windows Vista at regular users. This has the effect of reassuring users that your application won’t perform unsafe operations without their knowledge. Edit and Continue ā–  While you are debugging your application, the Edit and Continue feature lets you modify the code, move back and forth in the debugger, re-execute code, add functionality, or fix bugs on the fly without stopping program execution. Debugger visualizers ā–  While you are debugging your application, the visualizers give you an easy way to get readable representations of your application data. They give you a human-readable representation of the stored data, even for more complex types found in ADO.NET or XML. Community Access and Start pages ā–  With these features, you can access additional information from online communities and from different sources of online help, including diverse RSS feeds. (RSS can stand for Rich Site Summary or Really Simple Syndication and is a family of XML file formats; it is widely used by the weblog community and news Web sites.) Simplified development environment ā–  Everything in the development environment was created so that you can easily access key functionality, tools, and objects. As you can see, Visual Basic 2008 Express Edition includes many nice features to help new programmers develop applications in a fast and fun way. These features will provide guidance even when you’re not necessarily sure what syntax or components to use and will greatly expedite learning the product.
  • 29. 14 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! In Summary… You now know that .NET is a framework composed of compilers, tools, languages, debuggers, and an execution engine. The CLR is that execution engine, and it is responsible for loading and executing managed applications. In essence, .NET is like a house with the CLR as the foundation and all other services built on top of it. You also learned that the CLR didn’t change with Windows Vista and Visual Studio 2008, but a lot of new building blocks have been added so you can take advantage of features provided by Windows Vista and make developing applications easier. In addition, you learned that Visual Basic 2008 is an object-oriented programming language that has a simpler syntax than most modern programming languages. You also started to learn what object-oriented programming is and the basics of OOP in Visual Basic 2008. This chapter gave you the opportunity to hear about the most important features of Visual Basic 2008 Express Edition. In the next chapter, you’ll learn how to install Visual Basic 2008 Express Edition.
  • 30. 2 15 Preparing to Install Visual Basic 2008 Express Edition, 16 Installing Visual Basic 2008 Express Edition, 17 Chapter 2 Installing Visual Basic 2008 Express Edition In this chapter, you’ll install Microsoft Visual Basic 2008 Express Edition and start getting to know what components are included with it. I’ll guide you through all the steps of this installation so that you will be ready to start building applications using Visual Basic 2008 Express Edition right away. In addition, I will talk about some common installation scenarios, give you some tips for installing the product, and cover what to do if the unexpected happens. The installation process is easy and straightforward, following in the spirit of the Microsoft Visual Studio Express editions.
  • 31. 16 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! You have a couple of options for installing Visual Basic 2008, particularly if you’ve had previous versions installed or if you installed an early (prerelease) version of the product. Before you start the installation, make sure your computer meets the software and hard- ware recommendations. Review the introduction of this book for all the necessary informa- tion. You will also want to be sure that your computer has the latest updates from Windows Updates (http://windowsupdate.microsoft.com) and Microsoft Updates (http://update. microsoft.com). Installing the latest updates will ensure that your computer has all the lat- est security updates along with some installation prerequisites before starting the product installation. If you have an antivirus or antispyware application installed and running, it might prompt you to choose to allow certain setup tasks to proceed. For instance, with the latest Microsoft Windows Defender (http://www.microsoft.com/athome/security/spyware/software/default. mspx), I was asked two times to allow certain tasks to proceed, and a few other times the antispyware product recognized the source and simply mentioned it and continued. If you are using a different antispyware application, your experience might vary slightly, but it will bear some similarities to this process. These antivirus and antispyware products are giving you an opportunity to confirm the origin of the product you’re about to install. When you’re sure it’s from Microsoft, let the setup application continue its job by choosing to allow the action. During the installation, if something goes wrong, you’re probably not the only person to encounter the problem. Your first step is to look at the latest Readme information main- tained by the setup team on MSDN and follow the steps provided to solve the installation problem. Here is the link: http://www.microsoft.com/express/support/. Side-by-Side Installation If you have a previous version of Visual Studio on your computer, say Visual Studio 2002 or Visual Studio 2003, installing Visual Basic 2008 Express Edition (or any Visual Studio 2008 product) will be straightforward. This is considered a side-by-side execution, and you can go straight to the ā€œInstalling Visual Basic 2008 Express Editionā€ section about installing the software. Preparing to Install Visual Basic 2008 Express Edition C A U T I O N Please make sure you carefully read the article at http://msdn2. microsoft.com/en-us/vs2008/ bb964521.aspx before starting the uninstall process!
  • 32. Chapter 2: Installing Visual Basic 2008 Express Edition 17 Prerelease Versions of Visual Basic 2008 Express Edition When you uninstall a prerelease version of any software, you might encounter problems. At some point, you might have no choice but to reformat your hard disk and reinstall your operating system. This situation is not uncommon when you work with prerelease software, but there is a solution. Before beginning the uninstall procedure, and as a precautionary measure, be sure to back up all your data. If possible, a good practice is to avoid installing any prerelease versions of any products on your main computer. Using a test machine (or virtual software) will help you avoid losing any important data and won’t slow your produc- tivity in the event something goes wrong. You can learn more about the virtual solution that Microsoft offers, called Microsoft Virtual PC 2007, at http://www.microsoft.com/windows/ virtualpc/default.mspx. Luckily with Visual Studio 2008, all Community Technology Preview (CTP) and pre–Beta 2 versions were ā€œtime-bombedā€ virtual images provided by Microsoft; therefore, the chance of ruining your main computer has been almost eliminated. You simply have to delete the Virtual PC image provided by Microsoft, and you should be good to go with the released version of the product. But if you have installed Visual Basic 2008 Express Edition Beta 2 and you didn’t use a Virtual PC image, you will have to uninstall the beta version before you proceed with installing the released version. Installing Visual Basic 2008 Express Edition Now that we’ve addressed a lot of potential issues and your computer is ready, you can proceed with the installation. You will find a companion DVD with this book that contains a full working edition of the product. Simply insert it into any available CD/DVD drive in your system, and follow the steps listed next. M O R E I N F O Because of a new feature called multitargeting, you can compile any project to .NET 2.0, .NET 3.0, or .NET 3.5. After success- fully installing Visual Basic 2008 Express Edition, you can safely uninstall Visual Basic 2005 Express Edition because with Visual Basic 2008 Express Edition, you can tar- get .NET 2.0 and also get the ben- efits and new features of Visual Basic 2008 Express Edition. N O T E Even though Microsoft doesn’t officially support prerelease ver- sions of the software, you will find resources on Microsoft’s Web site to help you with instal- lation. In particular, you will find information on how to uninstall (and in what order to uninstall) the products. Look at the forums at the following address for help on uninstalling any Beta 2 instal- lations (you’ll need to sign in using a Windows Live ID to get to this article): http://forums. microsoft.com/msdn/showforum. aspx?forumid=1346&siteid=1.
  • 33. 18 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! TO INSTALL VISUAL BASIC 2008 EXPRESS EDITION If autorun is enabled, the installation process should start automatically. If it doesn’t start automatically after a few seconds, follow these steps: 1. Click the Start button, and then click Computer. 2. Right-click the CD/DVD drive that has the product media, and select Explore. 3. In the list of files, locate and double-click Setup.hta to start the Installation Wizard. 4. On the Welcome to Visual Studio 2008 Express Editions Setup page, click Microsoft Visual Basic 2008 Express Edition. Within a few seconds, you should see that the setup program is copying all the neces- sary installation files to a temporary folder, as shown in Figure 2-1. When the setup program is done copying the files, the setup application loads into memory. While the application is loading, you’ll see an initialization progress bar, as shown in Figure 2-2. Next, you’ll be greeted by the Welcome to Setup page (Figure 2-3), which provides some information about the product and the possibilities you’ll have working with it. You can select the check box if you want to send anony- mous data about your experience installing the product to Microsoft. This program is totally anonymous, and you can read the policy to see exactly what type of information will be sent. Click Next to continue or Cancel to exit the installation program. To continue the installation process, you must read and accept the license terms (Figure 2-4). Please read the terms carefully to see what you can and can’t do with this product. When you have finished and you’re ready to accept the license agreement, select the option button that says you have read and accepted the license, and then click Next to continue. I M P O R TA N T If you install Visual Basic 2008 Express Edition on the Windows Vista operating system, you should be prompted by the Windows Vista User Access Control dialog box to give the setup process permission to continue. If you have been using Windows Vista for a while, you have probably seen this dialog box many times. Click Continue to proceed with the installation. Figure 2-1 Copying setup files locally to a temporary folder N O T E You’ll have nothing to do but wait at this point. The wait should not be long—less than a minute in most cases, depending on your computer’s speed. Figure 2-2 Initializing the setup process M O R E I N F O You’ll see a check box at the bottom of the License Terms page that enables Visual Studio to receive and display plenty of useful information, such as tips, blogs, and samples about .NET and Visual Basic. If you clear it, you can always select it again after the product is installed by using the Tools menu.
  • 34. Chapter 2: Installing Visual Basic 2008 Express Edition 19 Figure 2-3 Welcome to Setup page Figure 2-4 License terms The Installation Options page appears, as shown in Figure 2-5. On this page, be sure to specify that you want access to the Help system (MSDN Express Library) and Microsoft SQL Server 2005 Express Edition. SQL Server 2005 Express Edition is a relational database management system (RDBMS) with which you can easily manipulate data in your application. This is an important step. For example, if you’re creating the DVD collection management application that is included as one of the Starter Kits, all the data related to your DVD collection will need to be stored in a database using SQL Server 2005 Express Edition. N O T E The only reason not to install the local MSDN Help or SQL Server 2005 Express Edition is limited hard disk space. Be sure you understand the consequences of your selections. If you don’t install MSDN Express Library, you’ll need access to the Internet to get help from MSDN Online. If you don’t install SQL Server 2005 Express Edition, you won’t be able to create applications that need to access other sources of data, such as Microsoft Access database information, XML files, or other types of RDBMS information. In addition, some sample files from this book won’t work automati- cally, and you’ll have to perform some manipulations or re-instal- lations to get them to work.
  • 35. 20 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! Figure 2-5 Setting your installation options The last product to install is Silverlight. Although we won’t use Silverlight directly in this book, I strongly recommend you install it because you will have a smoother and richer experience on many Web sites. Silverlight 1.0 will not take up a lot of disk space, because it is only a few megabytes. When you’re done with your selections, click Next to continue. The Destination Folder page appears, as shown in Figure 2-6. This page will ask you where to install the software on your computer. I recommend you use the default location. Click Install to start the installation. The installation progress bar appears, which means the installation is underway! (See Figure 2-7.) This might be a good time to get something to drink because the installation could take some time. M O R E I N F O Silverlight, previously named WPF Everywhere (WPF/E), is a cross-browser, cross-platform plug-in for delivering the next generation of .NET-based media experiences and rich interactive applications for the Web. From a user point of view, Silverlight behaves like Adobe Flash, but Silverlight is richer in terms of what you can do and, more specifically, how you can do it. With Silverlight 2.0, for example, you will be able to use your Visual Basic skills and expertise to develop Silverlight applica- tions. You can find nice samples, documentation, and much more about Silverlight at http://www. silverlight.net. C A U T I O N If you choose to install the soft- ware in a folder other than the recommended default, you might have problems working with some of the paths and files men- tioned later in the book. If you do install in a different location, rest assured I’ll give you some cautionary notes whenever you might run into problems. N O T E The installation time will vary on the basis of your choices on the previous page. On average, if you selected both MSDN Library and SQL Server 2005 Express Edition, the installation should take about 10 to 30 minutes, depending on your computer’s speed.
  • 36. Chapter 2: Installing Visual Basic 2008 Express Edition 21 Figure 2-6 Destination Folder page Figure 2-7 Installation Progress page Here is the list of components that will be installed: The .NET Framework 3.5 ā–  This was the outer circle of the image illustrated in Figure 1-1. Visual Basic 2008 Express Edition ā–  This is the tool itself. Microsoft SQL Server Compact 3.5 ā–  This is a version of SQL Server that lets you, as the developer, embed a compact database on smaller devices, such as Windows Mobile– based phones or even on your Windows–based desktop or laptop. MSDN Express Library for Visual Studio 2008 ā–  This was described earlier. SQL Server 2005 Express Edition ā–  This was described earlier. When the Setup Complete page appears (see Figure 2-8), you are now finished with the installation. That wasn’t too painful, was it? Before you click the Exit button, please read the following notes.
  • 37. 22 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! Whenever you install a new application, it’s always a good habit to go to Microsoft Update (http://update.microsoft.com) or Windows Update (http://windowsupdate.microsoft. com) to get all the high-priority updates. Or you can click the Microsoft Update hyperlink from the setup application, as shown in Figure 2-8. I prefer Microsoft Update because you get all the updates you need for all the Microsoft software already installed on your hard disk. You’ll get updates for Windows, the Microsoft Office system, SQL Server, Windows Defender, and the .NET Framework along with your hardware drivers updates, all in one stop! It’s also important to verify that your antivirus application and its signatures are up-to-date and that you have updated antispyware installed. Finally, in Control Panel, open the Security Center, and make sure all lights for the firewall, virus protection, automatic updates, and all other security settings are green. If not, address those issues to prevent any security hazards. Click the Exit button when you are done. If you elected to send the feedback of your installation to Microsoft on exit, the setup application will send it to Microsoft’s servers, as shown in Figure 2-9. Figure 2-9 Sending installation feedback to the Microsoft servers T I P In the future, more products will be added to the list of products supported by Microsoft Update. Figure 2-8 Setup Complete page
  • 38. Chapter 2: Installing Visual Basic 2008 Express Edition 23 In Summary… This chapter focused on installing Visual Basic 2008 Express Edition. It addressed most issues you might encounter during the installation, it covered different setup scenarios, and it provided links to MSDN for more help. After working through this chapter, you should now have the .NET Framework 3.5, Visual Basic 2008 Express Edition, MSDN Express Library for Visual Studio 2008, SQL Server Com- pact 3.5, Silverlight 1.0, and SQL Server 2005 Express Edition installed and ready to go. Your computer should also be up-to-date with all updates installed and all security settings on green. Whenever you’re ready to explore the integrated development environment (IDE) and write your first two applications, just jump to the next chapter.
  • 40. 3 25 Three Types of Applications: What Are the Differences?, 26 Getting Started with the IDE, 28 Building the Projects, 31 Chapter 3 Creating Your First Applications You’ve installed Microsoft Visual Basic 2008 Express Edition, so now it’s time to create your first applications. You’ll start this chapter by learning about the differences between console applications, Windows applications, and Windows Presentation Foundation (WPF) applications. You’ll then look at the integrated development environment (IDE). As its name implies, the IDE is the application that provides all the tools you need to design, plan, develop, and distribute your applications. You could use any text editor, such as Notepad, for example, to create your applications, but in this chapter and for the reminder of the book, you’ll be using the IDE. Most programming books usually start with a fairly simple application called ā€œHello, World.ā€ Your first application will be a simple application as well, but you’ll be creating an application that does a little bit more than just say ā€œHelloā€ to the world. Specifically, you’ll learn to create an application that adds two numbers together and outputs a result. With this application you’ll also learn about Solution Explorer as well as the documentation and Help system built into Visual Basic 2008 Express Edition.
  • 41. 26 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! In this chapter, you’ll create two versions of the same application: a console application and a Microsoft Windows application. You might wonder why you even have to worry about the type of application when you’re creating a program. Often, the type of application you create depends on the purpose of the application and how users will interact with it. Sometimes your application doesn’t need to have a graphical interface. For instance, some applications need to be executed in a script or a batch file, or they don’t need a graphical interface because no user usually interacts with the application except to start it. This type of application is called a console application because everything is displayed in a system console window. You might have heard these types of windows referred to by many different names: a DOS window, a command prompt window, or simply the command window. The most common output in a console application is simple text. Figure 3-1 shows the result of the famous ā€œHello, Worldā€ application as a console application. Figure 3-1 A console application Three Types of Applications: What Are the Differences? N O T E Please note that console appli- cations are still executed in Windows but in the console. M O R E I N F O Simple text (also called ASCII characters) is the usual output of a console application, but some console applications use ASCII graphic characters. (ASCII stands for American Standard Code for Information Interchange.) An ASCII code is the numerical representation of a character (such as 0 or #) or an action of some sort. Pressing Enter in a word processor to move to a new line of text is an action represented by an ASCII character, for instance. The ASCII graphic character set, also called extended ASCII characters, includes vertical lines, vertical double lines, corners, and much more. ASCII characters are sometimes used to create boxes around text in console applications. Unicode characters are similar to ASCII but are not encoded in the same way. They are more extensive and can represent dif- ferent locales. N O T E Console applications can be written in many different pro- gramming languages (C, C++, C#, Visual Basic, and so on) and scripting languages (Perl, Python, JScript, and so on).
  • 42. Chapter 3: Creating Your First Applications 27 Console applications can be much more complex than the ā€œHello, Worldā€ example shown here. In fact, they can have as rich a set of features as Windows applications. The only difference is that they don’t have a graphical interface. For example, in corporate data centers, many applications execute all day and night, producing a large amount of data. It would be time- consuming and problematic to rely on people to verify the data. So, data centers are usually highly automated to facilitate this job; they use console applications that produce, manipulate, and verify the data in scripts or batch files. In contrast to a console application, a Windows application has a graphical interface, as shown in Figure 3-2. (This type of application is also called a Windows Forms application in .NET.) These applications are usually accessible from the Windows Start menu, and by default they share some common characteristics, such as a Close button, a Maximize button, and a Minimize button, as shown here: A third type of application—a WPF application—also has a graphical interface and looks similar to a Windows application; however, WPF applications use a completely different set of libraries to generate their executable files. For our work in this chapter, it is enough to say that WPF applications can provide a richer experience and use a different approach for their design. Figure 3-3 shows a WPF application in action. I will explain them much more fully in Chapter 6, ā€œModifying Your Web Browser.ā€ Figure 3-2 A Windows application includes a graphical interface. Figure 3-3 A WPF application N O T E A Windows service is a type of Windows application that runs on Windows in the background; it doesn’t have a user interface, doesn’t produce any visual out- put, starts when Windows starts, and doesn’t even require a user to be logged in to start executing. Windows XP Service Pack 2 (SP2) and the Windows Vista operat- ing system come with roughly four dozen Windows services. For example, one built-in Windows service validates your user name and password at start-up.
  • 43. 28 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! To get started writing the code for the console version of your first application, you’ll need to start Microsoft Visual Basic 2008 Express Edition. To do this, follow these three easy steps: click Start, click All Programs, and then click Microsoft Visual Basic 2008 Express Edition. Before we go further, let’s pause and admire the IDE in all its glory. Look at Figure 3-4, and feel the excitement. Figure 3-4 The IDE in all its glory Getting Started with the IDE N O T E The first time you start Microsoft Visual Basic 2008 Express Edition, it will take some time to load because the IDE is being config- ured for the first time.
  • 44. Chapter 3: Creating Your First Applications 29 If you’re not feeling the excitement yet, you soon will be. The development environment has been designed to make a lot more information available up front and to make you more productive more quickly. From this screen, everything you need to build an application is available in a couple of clicks. This is where you type your code, compile your code, launch the application, find your mistakes and fix them, get help on the syntax, and perform many other tasks. Furthermore, the Visual Basic 2008 Express Edition IDE is designed to generate a lot of code for you so that you have less to type. If you didn’t have the IDE and you wanted to write a Windows Forms application, you would have to type a lot more code, and this is prone to errors. With the IDE, most of the actions you’ll perform will automatically generate the code for you behind the scenes. As you spend more time with the IDE, you’ll find that there are many ways to perform the same actions. For instance, to complete a specific action, you can use a series of menu choices, you can use a keystroke shortcut, you can click an icon on a toolbar, you can click a hyperlink in a page, or you can right-click and choose an option from a context-sensitive menu. Before diving into our first application and before writing some code, we’ll go through each big component of the IDE. The first page you see when you start the IDE is a really useful one: the Start Page. It contains a lot of useful information: Recent Projects pane ā–  Here you’ll get the list of projects or solutions that were recently opened. You can also create a new project or open an existing project that is not in the list. Getting Started pane ā–  I call this useful pane ā€œHelp Centralā€ because if you need quick help, this is one of the best places to get answers. Whether you need help with some Visual Basic constructs, you want to see a list of how-to articles, or you simply want hyperlinks to communities of programmers, you can often find these items in the Getting Started pane of the IDE. Visual Basic Express Headlines pane ā–  This is where you find specific news about Visual Basic Express Edition from Microsoft. These product headlines deliver special messages specific to Visual Basic 2008 Express Edition and announce new updates, new releases, new code snippets, or anything that needs attention on your part. T I P The first and only rule of this book is to not be afraid to experi- ment. Click, look, read, and try whenever possible. This is really the best way to learn. I’ll show you some important material, tips, and tricks throughout this book, but my advice to you is to go beyond these examples and just try and try and try. N O T E I will show you how and where to look for this generated code in Chapter 5, ā€œUsing Rapid Application Development Tools with Visual Basic 2008.ā€ N O T E Some hyperlinks on the Start Page require a live connection to the Internet. So if you are unable to read the hyperlinks, please verify your Internet connection status.
  • 45. 30 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! MSDN feeds ā–  This pane of the Start Page includes hyperlinks to articles from one of MSDN’s Really Simple Syndication (RSS) feeds. You can configure these articles for any valid RSS feed from the Web. The default is set to the MSDN Visual Basic 2008 Express RSS feed. These articles are usually different from the ones under Visual Basic Express Headlines; occasionally they might be the same, but the articles from MSDN cover not only Visual Basic Express Edition but also topics including Visual Studio Team Systems, Microsoft SQL Server, Web services, and so forth. You can modify the feed by clicking Tools and then Options, expanding Environment, selecting Startup, and updating the Start Page News Channel field with a valid RSS feed of your choice.. 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 options available change based on the current context. For example, when you don’t have a project open, you have fewer menu choices: 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 popular actions that you can also perform by going through the menus. Toolbox ā–  The Toolbox contains controls that are used in your applications. If you scroll over the Toolbox on the left side of the Start Page, the Toolbox will expand. If you don’t have a project open, the Toolbox will be empty. 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 boxes, menus, toolbars, and so on. I’ll explain these controls in greater detail in Chapter 5. Solution Explorer ā–  This feature lists the files and components in your project. If no project is open, it will be empty. You’ll learn more about Solution Explorer later in this chapter. 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 N O T E The Microsoft Developer Network (MSDN) is a set of online and offline services designed to help developers write applications using Microsoft products and technologies. N O T E If you don’t see Startup and other settings in the Options dialog box, ensure that you select the Show All Settings check box in the lower-left corner of the Options dialog box. T I P If you accidentally close the Start Page and you want to display it, you can always get it back by clicking View, Start Page.
  • 46. Chapter 3: Creating Your First Applications 31 message on your screen such as ā€œLoading project c:blablablabla.vbproj 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ā€ depend- ing on the success of the process. Building the Projects From this point on, you’ll focus on what you really came here to do: build some projects. Let’s start with your first application—the console version of the application that adds two numbers together. Building a Console Application We’ve been talking about what a console application can do and what it will look like, so why don’t we build one? In this section, you’ll create a simple mathematic application. TO BUILD A CONSOLE APPLICATION 1. If Visual Basic 2008 Express Edition is not running, start it by clicking Start, All Programs, Microsoft Visual Basic 2008 Express Edition. You can choose to start building your application either by clicking the New Project icon on the toolbar, by selecting Create: Project from the Start Page, or by clicking File, New Project on the menu bar. 2. In the New Project dialog box, select Console Application in the Templates section, and type MyFirstConsoleApplication in the Name box. The New Project dialog box should be similar to the one in Figure 3-5. Click OK to create the project. T I P For demos and samples, I recom- mend you type all the source code in the following examples so that you can better understand the concepts involved. However, for longer source code listings, you can also download the com- pleted code samples (http:// www.microsoft.com/mspress/ companion/9780735625419). N O T E By default in Visual Basic 2008 Express Edition when you click OK, projects are created in a temporary location. When you save or close the project, files are saved in DocumentsVisual Studio 2008Projects. (On Windows XP and Windows Server 2003, you’ll find them in My Documents Visual Studio 2008Projects.) You can change the default proj- ect location by clicking Tools, Options, Projects and Solutions and finding the first text box named Visual Studio Projects Location. We’ll look into what files are created and what their content is in Chapter 5.
  • 47. 32 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! 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 look like the one shown in Figure 3-6. Getting to Know Solution Explorer Before you write the code, you need to learn about Solution Explorer. Shown on the right side of the screen in Figure 3-6, Solution Explorer provides an organized view of your projects and all the files 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, the resource files (such as the application icon), the configuration files, and so on, in Solution Explorer. T I P If you accidentally close Solution Explorer, you can get it back by clicking View, Solution Explorer.
  • 48. Chapter 3: Creating Your First Applications 33 Figure 3-6 MyFirstConsoleApplication without the code If you want more information about 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 disposal. T I P Note that the Start Page is still available; it’s simply a separate tab. You can go to any window by clicking a specific tab or by press- ing Ctrl+Tab.
  • 49. 34 Microsoft Visual Basic 2008 Express Edition: Build a Program Now! Getting Help: Microsoft Visual Studio 2008 Express Edition Documentation If you want to read more about Solution Explorer, you need to be introduced to Help and the documentation system. You access the documentation by pressing F1 from within Visual Basic 2008 Express Edition or by using the Help menu. The first time you press F1 or use the Help menu, you’ll be greeted with the Online Help Settings dialog box, as shown in Figure 3-7. Figure 3-7 Online Help Settings dialog box This dialog box 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 local Help as the primary source; otherwise, choose online Help as your primary source since it is the best source for the latest information.
  • 50. Chapter 3: Creating Your First Applications 35 Once you’ve made your selection, you’ll see the documentation’s graphical interface, as shown in Figure 3-8. Figure 3-8 Microsoft Visual Studio 2008 Express Edition documentation The toolbar at the top of the window includes several interesting elements that will help you find exactly what you need. Figure 3-9 shows the most important buttons on the toolbar.
  • 51. Another Random Scribd Document with Unrelated Content
  • 52. ā€œThe public debt, enormously increased for the last fifteen years, the civil list, the crown revenue, the pensions of the royal family, are not within the limits of our control. Every debt is sacred, but some are yet in suspense. For example, whilst all the European powers were largely indemnified according to their pretensions (English claims even to three times the amount allowed to French creditors), had the United States shown some hostile feelings towards us, or had they merely asserted their claims in concert with the other powers, their demands would have been immediately liquidated. But they have never yet been adjusted, because that nation would not join the enemies of France, who were then to be found in her bosom, notwithstanding what has sometimes been said at this tribune to the contrary. ā€œWith regard to the civil list, gentlemen, it might perhaps be desirable, both for its proper management and the personal comfort of the king, that the appropriations not included within the king’s personal expenses should have been granted under the forms of accountability adopted in the civil list of England. ā€œThe appropriation for the criminal judiciary department furnishes me another opportunity of again proffering my warmest wishes for the abolition of capital punishment, which the uncertainty of human comprehension renders so alarming, and which must particularly appall those generations who have so irretrievably suffered from the furies of parties; and also for the abolishment of branding, called for on all sides. May the minister at the head of the judiciary department affix his name to these two salutary measures! ā€œOne of my honorable friends has adverted to the gratuitous magistracy of English justices of the peace. I do not envy this pretended benefit of our neighbors, and it is my opinion that those great proprietors are not the most proper persons to exercise a sovereign jurisdiction over all the petty offences committed within their department; but I cheerfully concur in the unanimous voice for restoring the principle of temporary election in justices of the peace. ā€œNothing can be more gratifying to my feelings than to have heard, on the last discussion on trials by jury, the pledge that the propriety of extending the benefit of this institution to the
  • 53. transgressions of the press will be taken into consideration at the next session. ā€œI cannot withhold my assent to the observations of the report on the whole of ministerial budgets. I had myself said at this tribune in 1819, ā€˜It would be highly beneficial that every ministry should inquire, with all conscientious severity, into what is necessary to the due performance of their duties, and should propose in all remaining details, terms as generous and complete as they please, for the security and comforts of those actually in office, provided that ministers should be divested of all parasitical service, and children brought up to a more profitable labor than the industry of obtaining situations, which is so detrimental to every kind of industry, and to the independence of a vast number of citizens.’ The specification,—I mean the application,—which can never be too minute, of every appropriation to every item of expenditure, has already made some progress; but how profuse those specifications, beyond which there is ministerial exertion, when compared with English budgets, of which I now hold in my hand three departments,—the artillery, war, and navy; and yet this is not a cheap government, to use an expression that has so often been charged upon me, and which I am so unwilling to deny. ā€œThe minister for foreign affairs has opened his career under the most critical circumstances; his official duties will be dictated by the loyalty of his personal character. The great political question is now, to decide whether this government will continue to follow the track of old diplomatic traditions, or whether, divested of all foreign influence and reminiscence, it will boldly assume the rank it behooves us to take at the head of European civilization; a post which, in my opinion, has always remained vacant, notwithstanding appearances contradicted by facts; a stand to which no foreign power any longer dares lay any claim. From that exalted station, France may and ought to resist coalitions in which none of her interests are involved. For my own part, I should have expected more satisfactory explanations and details before giving my assent to the late loan of eighty millions, but none would more readily consent to the measures necessary for the liberty and independence
  • 54. of Greece; to enable her by assistance to defend herself; to erect a barrier against the ambition of other powers; to abolish the ignominious sale of fellow-beings, and rescue from slavery all those wretched victims of whom our interference has hitherto been inadequate to their deliverance; and in this I should foresee the advantage of our commercial relations, which, in spite of narrow prejudices, will always find a benefit in extending to other people the blessings and comforts of education and liberty. ā€œFrance, so long accustomed to triumph over the most formidable coalitions, wonders at finding herself encumbered under petty manœuvres, the mysteries of which she cannot unravel. ā€œI will not mention our unfortunate and criminal expedition into Spain, nor the cruel lessons given to despotism, oppression, and aristocracy in the peninsula, the various and beautiful provinces of which are, I hope, destined to a better fate. But I must beg leave to call your attention to our enormous and foolish error with regard to the new American states.... What blindness, gentlemen, what complacency, can induce us obstinately to withhold our assent to the recognition of the South American republics, in return for insult, ingratitude, and bankruptcy? The British government itself, it is true, although under the direction of an illustrious minister, hesitated a while before adopting that step; but it no sooner saw the immense advantages accruing to the United States, from the priority of that recognition, and a timely official declaration of protection and sympathy, than it hastened to associate itself in the honor and profit of their new relations. After long expectations, gentlemen, France is still reduced to those half-way measures that create mistrust and discontent, whilst it is a well-known fact that French productions and manufactures find a better market in that extensive territory than those of all other nations. ā€œWhilst the freedom of worship is guaranteed by the charter, and its equality sanctioned by our new morals and habits, it is unnecessary to remark that, even under the ancient rĆ©gime, Catholic affairs never formed a special branch of the ministry. Amidst the attacks of the pretended supporters of the altar, I will also deprecate that cold fanaticism which endeavors to represent Christianity, an
  • 55. institution originally founded on social equality, as hostile to the rights and opinions of the people thus calling, as it were, for a sort of retaliating animadversion against opinions and practices that are totally distinct from worldly ambition. I will seek for the solution of that inextricable dilemma of the duty of the priest, considered both as speaking in the name of Heaven, and as a pay officer of state; but where shall I find it but in that country where religious freedom is more generally prevalent than in France, where the ministers of religion are more respected, and sectarians live in peace; in that government where no rights and regulations can give umbrage, but where, being altogether foreign to and distinct from all civil institutions and form of government, religious societies are formed without restraint and choose their own ministers. ā€œThe separation of the ecclesiastical department from the ministry of public instruction, I consider as much an act of piety as of sound judgment. But too much has yet been left to the infringements of the Catholic clergy. It is not only a religion of the state, but also a very prevailing one still to be found in those ordinances which ought to have secluded its special dogmas within the walls of the church, and confined its distinction of creeds to the circle of private families. ā€œNational instruction, gentlemen, and especially elementary education, that main-spring of public reason, of practical morality, of public peace and comfort, is at present the first want of the French population, as it is the first duty of government. You all know, gentlemen, how this duty is to be discharged. Methods of instruction have heretofore been protected in an inverse ratio to their being perfect and easy. Neither your paltry vote of 50,000 francs, nor 500,000 francs, can be adequate to the redemption of that most important of all social obligations. Under a competent and legal system of public instruction, I would consider five millions as the most desirable appropriation of a budget. ā€œMany statesmen appear to have forgotten,—some perhaps have never been aware,—that by the law of the 3d Brumaire, year IV., France was provided with the best system of instruction that ever existed in any country. It could not be consistent with that power which severed from the institute the class of moral and political
  • 56. sciences. Napoleon created the university, the monopoly and exigencies of which wounded the feelings of private families and displeased the true friends of liberty, but which was afterwards indebted to the invasion of Jesuitism, a privilege of another kind, for the credit of being looked upon as a liberal institution. In order to satisfy all parties it would be necessary, at the next session, to offer a plan for the organization of public instruction, wherein all the national duties of teaching should be strictly laid down, and all individual liberties respected; but every plan of education, particularly in its elementary bearings, would require the co- operation of true civil administrations. ā€œWhy is it, gentlemen, that in utter contempt of the most solemn pledges, we have preserved for fourteen years the whole imperial structure of the internal administration in France? those factitious municipalities, those unsettled councils, those despotic and turbulent prefectures and sub-prefectures, which have never been amended except for successively adding to their inconveniences, attributions, and appointments? When shall we see every section manage its own concerns, provide for all its own exigencies, and retain within its territory that portion of the taxes that we are afterwards compelled to send back to it? Is this idea unknown in France? But the constituent assembly, whatever has been said to the contrary at this tribune, had not only proclaimed useful and true doctrines; it had also organized a system of administration elected by the citizens, and was abolished only by the consulate and by the empire. Is it replete with such great difficulties? But when in 1815, Napoleon, in a fit of liberalism, restored the municipalities in accordance with the law of ’91, elections were made with remarkable celerity and moderation. The only embarrassment that could arise would be in the government, if instead of abiding by the dictates of eternal truth and of contemporary reason, it found it necessary to combine principle with exception, right with privilege, thereby perplexing and deluding the purest intentions. ā€œI will follow the report of the committee in the examination of the war department, merely with the view to support the proposition of placing in the civil list the payment of the king’s military household.
  • 57. You have also heard on this subject the excellent discourse, to which my honorable friend, General Gerard, has given all the weight of his experience and of his glory. The minister of war, in offering observations that will be made the subject of future deliberations, has just expressed his desire of completing our system of defence. Here, gentlemen, we naturally bring back to our memory the urgent call recently made by the ministry upon our patriotism to obtain the means necessary to a preserving policy, a respectable military strength, a guarantee of public tranquillity, a national dignity; and to an union of the people with the government. The minister had before represented the nation rising in a body at the voice of their king. I will not attempt, gentlemen, the solution of the problem; the knot has been untied by a celebrated writer whose authority is daily referred to. ā€œThe stationary National Guard, says an ordinance of the king, dated March, 1815, comprising a mass of three millions of landed and industrious proprietors, constitutes a local force extended on every point.... ā€œFrom this formidable mass, whose dearest interests attach them to the soil, may be formed voluntary corps constituting movable columns.... ā€œThus the nation, fighting on every point with the army, either in the line or as auxiliaries, will prove that a great people cannot unwillingly be brought under the yoke that they have once shaken off. ā€œGentlemen, I will only remind the government that eight years ago, in the session of 1820, the ministers then acknowledged that they had been in possession, for eight months, of the project of a law drawn up by a special commission, and you all know how it has hitherto resulted. ā€œThe glory of the French navy has resounded in every heart. The name of Navarino has been proclaimed with an unanimous concert by the throne and in the chamber, as it had been echoed by the whole nation; the brave Admiral de Rigny is perfectly secure against the censure of a recall. The infamous traffic of human flesh has been partly suppressed, but it is not yet totally extinct. With an entire
  • 58. confidence in the sentiments of the minister of marine on these important questions, I submit to his wisdom the idea of placing the slave trade on the same footing as piracy, as the law of the United States has given the example, since followed by England. With regard to the management of our colonies, gentlemen, there is so much to say that I could not briefly enter on the subject. I will merely remark that the system of colonization of the ancients is, in any opinion, much preferable to that of modern times. ā€œIn the law under consideration the minister of finance has undoubtedly surpassed all his colleagues; but when a thorough discussion is about taking place, I do not feel sufficient confidence to anticipate the opinions that you will hear from colleagues more learned and more skilful than myself. I should even consider myself worthy of reproach, had I not made it a duty to offer some of my ideas, but especially to call at this tribune for more effectual social reforms than can possibly be achieved by way of amendments.ā€ La Fayette was constantly the recipient of attention and distinguished honors, both in America and in France. The young men of Auvergne gave him a splendid banquet on the 23d of June, 1828. The old general’s toast was: ā€œTo the assembled young men of the three departments of Auvergne, and to our dear mountains; the volcanoes of these are extinct, but the sacred fire of liberty will never be extinguished among them.ā€ The marquis never forgot any of his friends, especially his American comrades, and his affection for the fathers was continued to the sons, as the subjoined letter to Charles A. Clinton, written to him by La Fayette upon receiving the news of the death of his father, De Witt Clinton, will demonstrate. ā€œParis, March 30, 1828. ā€œMy dear Sir: Your personal and friendly attentions to me make you a natural organ of the melancholy and affectionate feeling which I wish to be conveyed to the family of your lamented father. I regret the mournful and unexpected event as an immense loss to the public, and a great personal cause of grief to me. Bound as I was to
  • 59. the memory of my two beloved Revolutionary companions, your grandfather and grand-uncle, I had found a peculiar gratification in the eminent talents and services of their son and nephew, and in his kind and liberal correspondence, until personal and grateful acquaintance had impressed me with all the feelings of a more intimate friendship. I beg you to be to your afflicted family the interpreter of my deep sympathies, and to believe me forever ā€œYour most sincere friend, ā€œLa Fayette.ā€ At the celebration of the commencement of the Ohio and Baltimore Railroad, which occurred on the 4th of July, 1828, a pair of handsome morocco slippers, and a pair of beautiful white satin shoes were made by the cordwainers during the procession. The morocco slippers were presented to the venerable Carroll, on the ground; and the white satin shoes were subsequently transmitted to General La Fayette, together with the badges worn by the association. This compliment received the following reply:— ā€œLagrange, Sept. 11, 1828. ā€œGentlemen: With affectionate feelings of pleasure, I have received your kind letter, the badge bearing a likeness of our matchless Washington, and of my excellent friend, the surviving signer of independence, the ensigns of your association as they were worn by your worthy president, and an elegant pair of ladies’ white satin slippers, which were manufactured in the procession. For those gratifying marks of your remembrance and friendship, I beg you to accept my most grateful thanks. The anniversary of American independence, the commencement of the Baltimore and Ohio Railroad, have been happy associations. So I have seen, as it were, the commencement of your city in the first years of the Revolutionary struggle, of which this very day is one of the (1777) anniversaries, that of the battle of Brandywine; and it has been lately to me a matter of proud delight to witness the immense progress of Baltimore, a great and rapid increase of which we may now more than ever anticipate. Its happy effects upon every sort
  • 60. of trade and industry cannot be doubted, and I offer you the cordial congratulation and good wishes of your sincere and obliged friend, ā€œLa Fayette.ā€ The general also transmitted the following to the book-binders of the city, and to the editors of the American:— ā€œLagrange, Sept. 11, 1828. ā€œTo the book-binders of Baltimore. ā€œGentlemen: With a lively sense of gratitude, I have received your kind letter, and a copy of the apron and badge which on the late celebration, doubly dear to an American heart, were worn by the book-binders of Baltimore. Testimonies of your remembrance and affection are at all times highly gratifying to me, nor could they prove more welcome than on this momentous occasion, when the anniversary day of independence is hailed in common with the commencement of one of its most promising results, amidst the immense progress of every kind that has taken place since it has first been my happy lot to be admitted as a soldier of the United States, and particularly as a citizen of Maryland. I am proud to have been enabled to show specimens of American book-binding which every day excite European admiration. I beg you, gentlemen, to accept the respectful acknowledgments and affectionate good wishes of a veteran who would have been happy, in the procession, to have followed his venerable friend, the surviving signer of the glorious declaration; and to have expressed to you, on that great day, the sentiments of his deep gratitude and warm attachment. La Fayette.ā€ ā€œAfter other business during the second session of the twentieth Congress the Vice-President communicated a letter from the President of the United States, transmitting one received from Monsieur David, the artist, member of the Institute of France,
  • 61. professor of the School of Painting at Paris, and member of the Legion of Honor, who presents to Congress the bust of General La Fayette, which has been received with it.ā€ The following is a translated copy of the letter:— ā€œParis, Sept. 11, 1828. ā€œTo the President: I have made a bust of La Fayette, and would willingly raise a statue to his honor—not for himself, because he has no need of it, but for ourselves, who approve in so lively a manner the desire of expressing to him the affectionate regard and admiration with which we are inspired. The youth of the French nation is filled with admiration for the virtues of the youth and the old age of him whose likeness I send you. ā€œThey envy the glory that was acquired upon the American soil, by the side of the immortal Washington, and the defence of your noble rights. ā€œThey envy that glory which has been acquired on the soil of France, in the midst of the troubles of Paris and of Versailles, where, in breasting the storm, he wanted courage as little in the struggles of debate as he did in contending with the sword. They envy the glory which covers the brow whitened by age, but still sparkling with the fire of liberty and of patriotism. ā€œIt is in the name of this youthful feeling of the French nation, ambitious to imitate everything generous and great, that I offer you a work upon which my hands have been employed for some time and with great care. ā€œI could wish that it was more worthy of the subject—more worthy of the place which I am desirous to see it occupy. Yes, sir, I could wish that the bust of our brave general, of our illustrious deputy, should be elevated on a pedestal in the audience chamber of Congress, near the monument erected to Washington himself; that the son be placed by the side of the father, or, if you please, that the two brothers in arms, the two companions in victory, the friends of order and of law, may be no more separated in our estimation than they were in their devotion to the cause of liberty and in the hour of peril.
  • 62. ā€œLa Fayette is one of the ties that unite the two worlds. He visited the new one to remain there for a few months, and to salute once more your sacred land of justice and equality, and has returned to us after having partaken of your feasts and received the honor and the benediction of your nation. ā€œI hasten to render my homage in return—I present you with his image. It will be a memento that the original may often recall to the National Assembly those eternal principles upon which the independence of the state reposes, and which are the foundation of their safety. ā€œI am, with profound respect, Mr. President, your very humble and obedient servant, ā€œDavid, ā€œMember of the Institute of France, and professor in the School of Painting; member of the Legion of Honor.ā€
  • 63. The following is a description of the bust as given in the National Intelligencer:— ā€œThe bust is of a fine white marble, and is the work of P. J. David, of D’Angers, in France. ā€œIt is of a size larger than the life, and exhibits a fine likeness of that distinguished apostle of liberty. On the front is ā€˜Au gĆ©nĆ©ral La Fayette,’ and the name and residence of the artist, with the year (1828) of its execution. On the left side is an inscription, indented in the stone, in the following words: ā€˜La Fayette’s speech in the House of Representatives, Dec. 10, 1824.—What better pledge can be given of a persevering national love of liberty, when these blessings are evidently the results of a virtuous resistance of
  • 64. oppression, and institutions founded on the rights of man, and the republican opinion of self-government?’ ā€œOn the right side is the following:— ā€œā€˜La Fayette’s last words in his answer to the President’s farewell speech, Washington, Sept. 7, 1825: God bless you, sir, and all who surround us. God bless the American people, and each of their states, and the federal government. Accept this patriotic farewell of an overflowing heart; and such will be its last throb when it ceases to beat.ā€™ā€ The New York American of December, 1828, says:— ā€œA letter from General La Fayette, of December 29, from Lagrange, tells us—and as he belongs to the nation, we may repeat—that Madame Perier (the eldest daughter of Mr. George La Fayette) has just made him a great-grandfather. The same letter says, ā€˜I expect to be in town in a few days, and enjoy the agreeable American society which has convened there from the several parts of the Union. It will be something like a Washington winter.ā€™ā€ The following is the substance of General La Fayette’s address at the Fourth of July dinner in Paris, in 1829:— ā€œThe health of their venerable guest, General La Fayette, having been given, the general in returning thanks, stated the pleasure which he felt in celebrating this anniversary, which enabled him, as it were, again to breathe the American atmosphere. He spoke with high gratification of their associating him with the principles for which he had struggled under the illustrious and well-beloved Washington. The independence of the United States began a new era of political civilization, which will finally extend over the whole world, and which is founded on the natural rights of mankind. He was proud to own that the first declaration of those rights bore the indelible imprint of its American origin. He referred in eloquent terms to the delight with which all generous minds had hailed the recent triumph in Great Britain over religious intolerance, and earnestly advised the Americans in consolidating their constitution not to listen to European suggestions, nor admit any exotic materials. He concluded by giving a toast to ā€˜National Legitimacy,’
  • 65. which, while it choked and destroyed the weeds of privilege, nourished the roots of natural and solid right.ā€ In 1829 General La Fayette came into possession of a large property under the indemnity law, being the fortune of his own and his wife’s family, of which the Revolution had deprived them. We will quote from one more speech of La Fayette, in the French Chamber of Deputies, on the 9th of July, 1829. The question under discussion was the accordance of an eventual credit of fifty-two millions of francs. ā€œGentlemen,ā€ said La Fayette, ā€œthough I have voted against approving the budget of expenses, in the hope that its refusal would prove a prompt and efficacious means of obtaining those institutions and economies which France has for so long a time expected, yet I feel disposed to vote in favor of the credits demanded, provided the chamber receives those explanations which it stands so much in need of. I do not see in the great quarrel of the east, as regards ourselves, anything beyond our importance as an intermediate power in what is called the balance of Europe; only two classes, the oppressors and the oppressed; in the demarkation of states, nothing but their natural limits; in the well-being of a people, nothing but the advantage of all; and in the policy of France, nothing but a liberal and independent part to act. You know, gentlemen, that great and powerful alliance which would enslave and brutalize the human family. It covers the peninsula with blood, oppresses Italy, and throws other states into disorder. Vienna is its metropolis, and in spite of other pretensions, Don Miguel is its ideal type. ā€œEngland has pretended to favor the world with another beacon, whose light is sometimes extinguished, and at other times shines but to decoy; upon this point inquire of Italy, of Spain, and of Portugal. It is for France then, gentlemen, which finds herself more in accord with our ideas of the new civilization, to place herself at the head of that civilization; in that consists her glory and her interest; there, too, in case of need, will be found her ambition; and there, also, the dignity and the safety of her government. But to perform that noble task it is necessary that the
  • 66. government resolve no longer to fear either a representative or an armed nation, and that abandoning its former relations, it may be able to say to foreign powers, ā€˜Next to God, it is to the people of France that I am indebted for being elevated above your influence and beyond your pretensions.’ ā€œI will confine myself, gentlemen, to a few remarks on the grounds to which our attention has been invited by the application made for the credits now under consideration. ā€œSome of my honorable friends have spoken harshly of the expedition to the Morea; they have even thought that it was in no degree whatever entitled to public approbation; but I have so ardently desired some kind of interference, particularly French interposition, in behalf of Greece, that I cannot join them in their criticisms, and as to our portion of that generosity which was manifested in the relief afforded, without speaking of Russia, whose motives are obvious, it would be sufficient to advert to two discourses from the throne, in one of which the battle of Navarino is called by Charles X. glorious, while from George IV. it received the appellation of untoward, to prevent us from confounding the shades of the two interests in the cause of Greece, and to mark the distinction between the cannonading at Terceira and the hospitality at Brest. The last protocol, however, from London has humbled my pride and diminished my expectations. ā€œWhy, gentlemen, have the Greeks taken up arms? why have they endured so many calamities? why have they so freely shed their blood? It was to free themselves from paying tribute to the Turks; to build up again their ancient country; and to enjoy in their own way the blessings of self-government. But now, gentlemen, the protocol brings into fresh existence the odious tribute; the greatest part of Greece is shut out from Greece, and to govern the small portion which remains it is proposed to look, I know not where, or for whom, but for some foreign prince, a hospodar, a mongrel of the East and of the West, in whom the Greeks will only behold a vassal of the Porte, and for whom they must pay an additional tribute.
  • 67. ā€œAll this, gentlemen, may be very agreeable to Russia, which dreams already of new subjects there; and to England, which has always feared that in that country she would find rivals in the coasting trade; but not to France, whose interest it is to have there a friendly and powerful nation, a barrier against the conquering and commercial ambition of other powers. Upon that topic it is that we look for explanations. The government of Italy is enslaved by the influence of Austria. Italy, were she free, would be our friend. Spain, whose methods of justice consist in strangling by turns the patriots and the Carlists, will never, in truth, be our ally until she again becomes constitutional. ā€œAs to Portugal, it is in vain that the English government has lately sought to balance the mock sovereignty of the cortĆ©s of Miguel against those institutions which the British ambassador, let it be said, by the by, had imported for it from Brazil. ā€œGentlemen, the partisans of national laws cannot accept this concession; there is no legitimacy there where nothing can be found but a despotic violation of all rights, social as well as natural. Besides, we do not know in what manner these pretended cortĆ©s have been formed, and how the deputies, who were not of Miguel’s choice, were rejected. Let us hope, gentlemen, that public indignation, and the stupid attacks which have been lately made on the flags of other nations, will soon put an end to this infamous usurpation, and that in the mean time France will ever protest against the horrid expedient which would deliver up a young and innocent victim to the brutality of Don Miguel. I will not deny, gentlemen, that there have been troubles in South America and in Mexico, and that perhaps they yet exist there. Their troubles, however, have been exaggerated. I attribute them principally to two causes: to the threats, the impotent threats, of Spain, which lead to the permanence of disproportioned armies and the agitation of their leaders; the other cause is to be found in European intriguers, who persevere in obstinately attempting to introduce their old institutions into these new states. Put a period to the two causes, and the tranquillity of commerce will be immediately restored.
  • 68. ā€œThe minister of commerce observed a few days since that there was nothing in common between diplomatic relations and commercial interests in these countries. I have, however, in my possession a Mexican Gazette, containing a decree by which the productions of states that shall not have recognized the republic in the course of the present year shall be subjected to an additional duty, whilst those which shall send, during the year 1829, diplomatic agents to that country, shall be treated more favorably. It is time, gentlemen, that the government should at length yield to the commercial views of France. ā€œAs regards Algiers, I will leave that question to one of my honorable friends, who is better acquainted with it than myself; but I cannot forbear referring to a more serious attack on the national honor than that of the dey of Algiers throwing his fan. I allude to what has passed lately relative to the expulsion of Galloti. The delivering up of an alien for political causes has been unanimously reprobated in every age and by every country. Eminent jurisconsults have assured me that the laws of our country have been violated by the expulsion of that individual. I am willing, however, to admit that there has been, on the part of French agents, error and precipitancy, and consequently, as I doubt not, repentance. There has, however, been deception somewhere, and violence has been offered to the honor of France. Highway robbery and judgments in this case have been referred to; but are you ignorant of what judgments are, or of what they may be under absolute governments? ā€œSuppose, for example, Don Miguel were to say: ā€˜Behold the man who has in the palace of the king assassinated, with his own hand, the Marquis of LoulĆ©, the best friend of my father! Give him up to me that I may punish him for the crime.’ Would the accusation be believed? ā€œIn a word, gentlemen, the honor of France has been outraged; justice must be done; Galloti must be demanded; the demand must be enforced; he must be restored to the soil of France, and the national honor must in some way receive signal reparation.
  • 69. ā€œI will conclude, gentlemen, by observing that the explanations which the discussions may produce shall decide my vote.ā€ At a sitting of the Chamber of Deputies General La Fayette made the following remarks on the ā€œHoly Allianceā€:— ā€œThere was a vast and powerful league which desired to command and brutalize the human species. It has oppressed Italy, devastated the peninsula, and had disturbed other states. Its chief seat is Vienna, and Don Miguel its ideal type. England has pretended to set up another system, but it was only to lure states to their ruin. It was the business of France to place herself at the head of civilization—her glory, her interest, and her ambition to require it; but to fulfil this noble destiny it was necessary that the government should determine not to fear either a nation represented or a nation armed, and, renouncing all connections, it should say to foreign powers, ā€˜After God, it is to the French people that I am indebted for being placed above your influence and beyond your pretensions.ā€™ā€ During 1829 General La Fayette made a tour through some of the French provinces, and his reception by the people appears to have rivalled the enthusiasm displayed in his honor in the United States. One London paper says:— ā€œNever was a king so feasted and treated as this venerable remnant of the Revolution has been. In every quarter he has been received with shouts of triumph and congratulatory addresses, which, while they have been complimentary to him, have generally, also, been made the vehicle for strong philippics against the new order of things. From Grenoble to Lyons the road was thronged by continual crowds of people who came to testify their regard for the principles which had guided his political conduct, and the esteem which they entertained towards himself personally.ā€ g The Times observes: ā€œThe old general, from his early services in the cause of liberty,—from his immense sacrifices for his country,—from his intrepid consistency of character during a political career of forty years, during which the world turned around him or changed its principles several times, while he remained unchanged, is deservedly an object of great esteem and
  • 70. admiration. But why is he brought forward, or why does he make himself prominent on this occasion, type as he is of the Revolution? And why, when he does appear, is he so enthusiastically received? For no other reason but because the king has made choice of what is considered a counter- revolutionary cabinet, and because the people are desirous of evincing their adherence to the free institutions which they think at present threatened, by testifying their grateful admiration for one of the founders and champions of their freedom. Every shout of applause thus uttered for General La Fayette is a shout of defiance against the ministers; and every libation poured to his health is a kind offering to the memory of past struggles for liberty. The repetition of such scenes would have been thought impossible about two months ago.ā€ The following description of General La Fayette’s reception at Lyons is taken from an extract of a letter dated Paris, Sept. 16, 1829:— ā€œGeneral La Fayette has paid a visit this summer to his birthplace in Auvergne, and has been received on his passage in a manner worthy of his noble virtues, public as well as private. From his arrival at Chavaniac until his entry at Lyons, in every town and village through which he passed, he has witnessed the spontaneous homage of the patriotism of their inhabitants. The population of villages far distant from the road he travelled precipitated themselves before him on his passage, and the inhabitants of the cities through which he passed presented themselves en masse to welcome him within their walls. In spite of the orders sent by the ministry at Paris to the departmental authorities, to endeavor to suppress as much as was in their power the preparations made to receive the general, his triumphal march since he left La Grange, from the borders of the river Manche, to the foot of the Alps, has no other example in history, excepting his visit to the United States. Escorted from city to city by large cavalcades of horsemen, through arches of triumph prepared for the occasion on the high roads, saluted continually with enthusiasm by assembled multitudes, the thoughts of the veteran
  • 71. defender of liberty were often diverted to his brilliant reception in a distant hemisphere, whose liberties are as dear to him as those of his native country.ā€ The PrĆ©curseur and Journal of Commerce of Lyons says:— ā€œThe general arrived from Vienne on Friday, the 4th of September, escorted by one hundred and fifty horsemen. His arrival had been impatiently expected by the inhabitants of Lyons, and on reaching St. Synphoria, the deputation named to receive him were found waiting with a large cavalcade of horsemen and carriages, and a numerous assemblage of people who accompanied him to Lyons. At St. Synphoria the general descended from his carriage and was addressed by M. Prunelle, president of the deputation, who welcomed him on the part of the inhabitants of Lyons to this city; to which the general replied, in retracing the kindness with which he had been received at his last visit to that city before the Revolution in 1789, and expressing his gratitude for the flattering manner in which he was again received. He then ascended into an open barouche drawn by four horses, and conducted by two postilions, which were placed at his disposition by the deputation, and the procession proceeded to Lyons in the following order:— ā€œ1st. A detachment of 400 horsemen, composed of young men from Vienne and Lyons. ā€œ2d. The carriage with the deputation from the latter city. ā€œ3d. The barouche containing the general, Mr. George La Fayette, and the president, M. Prunelle, surrounded by a cohort of citizens on foot. ā€œ4th. The private carriages of the general, containing the Misses La Fayette, Mr. Adolphe Perrier, Mr. Bradford, United States consul, and the Count de Lasteyrie. ā€œ5th. The carriages of the committee of arrangements. ā€œA line of private carriages then followed, and so great were they in number, that on the arrival of the head of the procession at the bridge Charles X. at Lyons, the last of the carriages had but just reached the extremity of the long Faubourg de la GullotiĆØre, nearly two miles distant. The spectacle which presented itself on
  • 72. the entry of the general into the city was of the most magnificent description. An immense population, estimated at 70,000 persons, lined the bridge and streets through which the cortĆØge moved, and the reiterated cries of ā€˜Vive La Fayette,’ and continued manifestation of public joy, which filled the air during his passage to the HĆ“tel du Nord, where a suite of apartments had been prepared for him, were gratifying proofs on the part of the enthusiastic population of Lyons, of the love and admiration for the noble character and patriotism of their illustrious guest. In the evening after his arrival an orchestra of one hundred and twenty musicians serenaded under his windows, and the hotel was surrounded until a late hour by crowds of the curious, anxious to behold the countenance of the prisoner of Olmütz and the ardent defender of the liberties of France. ā€œOn the following day a splendid excursion on the river Saone, composed of about thirty boats of various descriptions, elegantly decorated, and some of them bearing the banners of France and of the United States, was prepared for the general, who embarked with his suite at twelve o’clock, greeted by the cheers of the immense assemblage of people who lined the borders of the river. On the arrival of the procession at the Isle Barbe, a salute was fired from the chĆ¢teau of the island, whence, after a short stay, the general returned to Lyons in time to attend the dinner offered him and Mr. George La Fayette by the different lodges of freemasons of that city. ā€œOn Monday the 7th inst. the grand banquet given in honor of the general took place at the magnificent salon Gayet, situated on the borders of the Rhone. The rooms were elegantly dressed with festoons, and at one end were seen the portraits of Washington and Franklin, and the bust of the distinguished guest crowned with a wreath of laurels. On his arrival at four o’clock, he was received with unanimous and reiterated cries of ā€˜Vive La Fayette!’ Five hundred of the inhabitants of Lyons, the Ć©lite of that city, sat down to a sumptuous dinner prepared for the occasion, at which presided M. Prunelle, assisted by thirty members of the committee of arrangements.
  • 73. ā€œAt the dessert the following toasts were given:— ā€œ1. By the president—The King of France. ā€œ2. ā€˜General La Fayette—other warriors have been victorious in battle, and other orators have pronounced eloquent discourses; but none have equalled him in civic virtues.’ ā€œGeneral La Fayette then rose and said:— ā€œā€˜You have been witnesses, gentlemen, of the marks of affection and confidence with which the population of Lyons has deigned to receive me within their walls; you yourselves have participated in that kind reception in a manner so flattering, and I am surrounded at this patriotic banquet by objects of such interesting associations, that it would be superfluous, and above all impossible, to express to you my feelings at this moment; the remainder of my life, gentlemen, will be consecrated to them. I am proud and happy that my visit here has furnished another occasion to your city to express its constant hatred of oppression, its love for true liberty, and its determination to resist every attempt of the incorrigible contre-revolution.’ The general then spoke of the privileges granted to the people by the constitution; their rights of being tried by jury, and of elections, and of the censorship of the press; and after having paid a just tribute to the noble and patriotic attitude that the National Guard of Lyons took at the important epoch of 1815, he took occasion to examine the position of the Polignac ministry, and the violent measures which it threatens against the liberties of France. ā€˜We are menaced,’ said he, ā€˜by hostile projects; but how will they be effected? Will they succeed by means of the Chamber of Deputies? My honorable friend and colleague, M. Couderc, now at my side, and every one of my colleagues who are now seated at this banquet, will attest that in the moment of danger the Chamber of Deputies will show itself faithful to patriotism and honor. Is it proposed to dissolve the Chamber? If so, it will then be the business of the electors of France, who certainly will return only deputies worthy of themselves and of the nation. ā€œā€˜Is it contemplated to vitiate the elections by more ordinances, and thus exercise illegal power? Let the partisans of such
  • 74. measures remember that the force of every government exists only in the arms and in the purses of the individuals composing the nation. The French nation knows its rights, and knows, likewise, how to defend them. Let us hope, however, gentlemen, that the plots against the liberties of the people are merely visionary, and, in the mean time, accept from me the following toast:— ā€œā€˜The department of the Rhone, and the city of Lyons—the ancient metropolis of industry, and the courageous enemy of oppression. May its liberty, its dignity, and its prosperity be solidly founded on the full enjoyment of those social and natural rights which it has ever defended.ā€™ā€ One hundred thousand copies of a pamphlet, containing an account of La Fayette’s late triumphal journey were published. But this triumphal journey occasioned much chagrin among the enemies of French liberty, and the government, already growing more and more hostile to friends of liberty, took petty spite upon some of their officials, as the following will show. The Paris Constitutional announced that ā€œthe minister of the interior has deposed the mayor and deputy-mayor of Vizille from their functions: the former, for having congratulated General La Fayette, upon his arrival in that town; and the latter, for having appeared on horseback when he entered.ā€ Another French paper says:— ā€œWe stated yesterday the deposition of a mayor for having joined in the honors to La Fayette. We now add the proceedings to which this intended disgrace gave rise. ā€˜The intelligence of this event,’ says the PrĆ©curseur of Lyons, ā€˜inspired the inhabitants of the commune with the greatest indignation, not being able to conceive why peaceful citizens may not, without crime, honor one of the worthiest public men of the nation. The whole population assembled spontaneously in the public square; there each one expressed his regrets, and recalled with delight the useful and honorable acts of the displaced magistrates. Thence they proceeded to the office of the mayor, where these functionaries
  • 75. still were, and there Mr. Romain Peyron thus spoke, in the name of his fellow-citizens:— ā€œā€˜Mr. Mayor and Mr. Deputy: The inhabitants of this commune have learned with the greatest pain that, by a decree of the minister of the interior, you were deprived of the functions you have discharged with so much zeal, and in which you have so justly acquired the confidence and esteem of those whom you had to serve. The motives which have afforded the new ministry a pretext for this act are too honorable to be made a cause for complaint! You are, gentlemen, the first citizens stripped of their official functions for having taken part in the honors paid to General La Fayette! Let us not envy the enemies of the public liberties this poor satisfaction while all France is still echoing with the acclamations which everywhere burst forth upon the passage of this great citizen, and especially in the second city of the kingdom! ā€œā€˜The general who was the object of this enthusiasm will live in history, in spite of the calumnies of party men! The people will always recollect that he was, at that time, the zealous defender of legal liberty, which, among us, includes attachment to constitutional monarchy; that, on the 5th and 6th of October, he twice saved the lives of the royal family; that, previously to the 10th of August, he sacrificed his popularity in order to snatch Louis XVI. from the dangers that threatened him; and that, proscribed for his energetic protest at the bar of the Legislative Assembly, and arrested in a neutral country, he expiated, in the dungeons of Austria, the crime of having always faithfully observed the line of duty! ā€œā€˜You, gentlemen, you too, fulfilled a duty, in not separating yourselves from all these under your care, in those imposing circumstances when the presence of our magistrates, as the organs of our unanimous sentiments, added a new value to their manifestation, and ensured tranquillity and good order in the midst of our rejoicings. ā€œā€˜Receive, therefore, the expression of our thanks and of our regret.ā€™ā€
  • 76. These testimonies of the esteem of their fellow-citizens abundantly compensated for the vengeance of the ministers. The prefect of the department, having designated M. Buscaillon as provisional mayor, that respectable old man answered, ā€œthat M. Finant having been removed by the minister of the interior for having taken part in the honors paid to General La Fayette, he was bound to declare that he himself had done the same thing, together with all the other inhabitants of the commune, and that he could not, therefore, trouble the minister to do justice upon another in similar error.ā€ M. Buscaillon will long be remembered for his noble refusal of a place dishonored by so gross intolerance.
  • 77. CHAPTER XIV. The Revolution of 1830—Proclamation to the French People—From the Journal du Commerce, Paris—Proclamation of Louis Philippe —La Fayette’s Official Announcement to the Municipality of Paris —Order of the Day issued by General La Fayette—Details of the Revolution—Charles X. driven from the Throne—The Deputies, escorted by the National Guards, offer the Throne to the Duke of Orleans—The Duke’s Reply—He is made Citizen King—Changes in the Charter—La Fayette’s Speech in the Chamber—Letters by La Fayette concerning this Political Upheaval—His Opinions regarding French Affairs—Review in the Champ de Mars—Order of the Day to the National Guards—La Fayette’s Account of the Revolution—La Fayette’s Personal Influence in France— Compliments of the London Press regarding him—La Fayette speaks on Capital Punishment in the Chamber—Letter from Paris regarding La Fayette’s Popularity—Encomiums in his Honor— Letter from Count de Lasteyrie—Incident of the Revolution— Resignation of La Fayette—Comments of the National Gazette— La Fayette’s Speech on the Slave Trade—His Remarks concerning the National Guard—La Fayette sums up the Results obtained by the Revolution of 1830—The Victory Popular—The Dynasty of Right Divine expelled—National Sovereignty declared—National Guard established—Liberty of the Press secured—Trial by Jury applied—New Electoral Law—Elective Administrations—La Fayette receives a Deputation from Philadelphia—Address of the American Minister—La Fayette’s Courteous and Patriotic Reply.
  • 78. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade Our website is not just a platform for buying books, but a bridge connecting readers to the timeless values of culture and wisdom. With an elegant, user-friendly interface and an intelligent search system, we are committed to providing a quick and convenient shopping experience. Additionally, our special promotions and home delivery services ensure that you save time and fully enjoy the joy of reading. Let us accompany you on the journey of exploring knowledge and personal growth! ebookultra.com