按键盘上方向键 ← 或 → 可快速上下翻页,按键盘上的 Enter 键可回到本书目录页,按键盘上方向键 ↑ 可回到本页顶部!
————未阅读完?加入书签已便下次继续阅读!
reviewed several books for Apress; covering C#; Visual Basic; ASP;
and other topics。
Andy is a keen football and rugby fan; and enjoys running and skiing
(badly)。 He lives by the seaside in Swansea with his wife; Jayne; and children;
Emily and Thomas; who have just discovered the thrills of surfing and
look much cooler than he ever will!
xvii
…………………………………………………………Page 20……………………………………………………………
…………………………………………………………Page 21……………………………………………………………
Introduction
The first puter programming book I read was titled Programming Windows 3。0 by Charles
Petzold。 This was around the time when Microsoft Windows 3。0 (circa 1992) once and for all
showed the industry that Microsoft was a pany with a future。 Writing code for Windows back
then was plicated by many things: lack of documentation; 16…bit architecture; and the
necessity of buying a piler separate from the software development kit (SDK)。 Charles’s
book tied everything together and solved the problem of how to write a program for Windows。
Now the problems are quite the opposite: we have too much documentation; we have 64…bit
architectures; and everything including the kitchen sink is thrown into a development environ
ment。 Now we need to figure out what we actually need。 We have too many options—too many
ways to solve the same problem。 What I am trying to do with this book is the same thing that
Charles did for me when I first started out; and that was to help me figure out what I needed to
write code。
This book is about explaining the Visual Basic programming language in the context of
solving problems。 Visual Basic has bee a sophisticated programming language that can
achieve many goals; but you are left wondering what techniques to use when。 This book is here
to answer your questions。
This book is not a reference to all of the features of the Visual Basic programming language。
I don’t explain the esoteric Visual Basic features。 I stick to the Visual Basic programming features
that you will use day in and day out。 That does not mean that you will be missing certain Visual
Basic programming language constructs; because I have covered all of the major features。
To get the full benefit of this book; I suggest that you do the exercises at the end of the chapters。
The answers are available on the Apress web site ( http://apress。); and you can cheat
and not do the exercises; but I advise against that。
If you are a beginning programmer who has no clue about Visual Basic; and you read this
book and do the exercises; I believe that you will be a solid and knowledgeable Visual Basic
programmer by the end of the book。 If that sounds like a big promise; well; yes it is。 The chapter
text is intended to get you acquainted with the Visual Basic programming language and how to
apply its features。 The exercises are intended to make sure you actually understand the Visual
Basic programming language and its features。
The chapter exercises are challenging。 They cannot be solved within a few minutes。 In fact;
when I did all of the exercises; it took me five working…hour days to do all of them!
If you have any questions; such as; “So what was he trying to get at with that exercise?” I am
available on Skype with the user ID christianhgross。 Please don’t just ring me。 First chat using
text; and if necessary; we can have a voice conversation。 Also; you can send e…mail to me at
christianhgross@gmail。。
Thanks and good luck。
xix
…………………………………………………………Page 22……………………………………………………………
…………………………………………………………Page 23……………………………………………………………
C H A P T E R 1
■ ■ ■
Ready; Steady; Go!
This book is about the Visual Basic programming language first and foremost。 It is about
being a proficient Visual Basic programmer。 Reading this book from cover to cover will not
make you a superstar; but it will make you a programmer who understands what needs to be
done when writing robust; stable; and maintainable Visual Basic applications。
In this chapter; you’ll get started by acquiring the tools you need to develop Visual Basic
applications and taking those tools for a test spin。 Along the way; you’ll create a couple Visual
Basic applications。
Downloading and Installing the Tools
Getting started with Visual Basic 2008; you’re probably really excited about writing some code
that does something。 It’s like getting your driver’s license and wanting to drive a car without
even thinking about where you want to go。 You just want to drive。 The great part of is that
you can start writing some code after you have installed either the software development
kit ( SDK) or a Visual Studio integrated development environment (IDE)。 Downloading
and installing the right environment is critical to taking your first step toward an enjoyable
coding experience。
■Note Software version numbers; product descriptions; and technologies can be confusing。 Having
used Microsoft technologies for over a decade; I can say that naming a technology or product has never been
Microsoft’s strong point。 The technologies have been great (for the most part); but product classification and
identification have not been so great。 Thus; this book covers the Visual Basic 2008 programming language
that is used to write applications for the Framework。 With Visual Basic 2008; the 3。0 and 3。5
Frameworks are used。 3。0 gives you all of the essentials; and 3。5 gives you the extras。
For the examples in this book; you’ll be using Visual Basic 2008 Express Edition; because
it’s freely available and has everything you need to get started with Visual Basic 2008。 The other
Express Edition IDEs available from Microsoft are tailored to different languages (C# and C++)
or; in the case of Visual Web Developer Express; specific functionality that is too restrictive for
our purposes。
1
…………………………………………………………Page 24……………………………………………………………
2 CH AP T E R 1 ■ R E A DY ; ST E A DY ; G O !
Microsoft also offers full versions of the Visual Studio IDE; such as the Standard; Professional;
and Team editions。 Each of these editions has different features and different price tags。 See the
Microsoft Visual Studio web site (http://msdn2。microsoft。/en…us/vstudio/default。aspx) for
more information。 If you already have Visual Studio 2008 Professional; you can use that for the
examples in this book。 That edition can do everything that Visual Basic 2008 Express can do;
and in fact; has many more options。
■Note I personally use Visual Studio Standard or Professional in bination with other tools such
as X…develop and JustCode! from Omnicore (http://omnicore。); TestDriven ( http://
testdriven/); and NUnit ( http://nunit。org)。 The Visual Studio products are very good;
but others are available。 Being a good developer means knowing which tools work best for you。
Installing and downloading Visual Basic Express from the Microsoft web site involves the
transfer of large files。 If you do not have a broadband connection; I suggest that you install the
IDE from a CD instead。
Downloading Visual Basic Express
The following is the procedure for dow