梓囚徒貧圭�鮗� ○ 賜 ★ 辛酔堀貧和鍬匈��梓囚徒貧議 Enter 囚辛指欺云慕朕村匈��梓囚徒貧圭�鮗� ● 辛指欺云匈競何��
!!!!隆堋響頼��紗秘慕禰厮宴和肝写偬堋響��
IDE from a CD instead。
Downloading Visual Basic Express
The following is the procedure for downloading Visual Basic Express from the Microsoft web
site。 By the time you are reading this book�察�the procedure may be a bit different�察�but it will be
similar enough that you¨ll be able to find and download the IDE package。
1。 Go to http��//microsoft。/express/。
2。 Select the Download Now� �link。
3。 Scroll down to the Visual Basic 2008 Express Edition section�察�as shown in Figure 1´1。
4。 Click the Download link。
5。 A dialog box appears�察�asking where you want to store the downloaded file。 The file that
you are downloading is a small bootstrap file�察�which you¨ll use to begin the actual
installation of the Visual Basic Express IDE。 Choose to save the file on the desktop。
These steps can be carried out very quickly!probably within a few minutes。 Do not mistake
this procedure for downloading the plete Visual Basic Express application�察�because that¨s
not what happened。 The installation procedure will download the vast majority of the IDE。
´´´´´´´´´´´´´´´´´´´´´´Page 25´´´´´´´´´´´´´´´´´´´´´´´
C H AP TE R 1 * R E AD Y �察 �ST E AD Y �察 �G O� �3
Figure 1´1。 Selecting Visual Basic 2008 Express Edition
Installing Visual Basic Express
After you¨ve downloaded the setup file�察�you can start the Visual Basic Express installation。
During this process�察�all the pieces of the IDE!about 300MB!are downloaded and installed。
Follow these steps�此�
1。 On your desktop�察�double´click the vbsetup。exe file。 Wait while the setup program loads
all the required ponents。
2。 Click Next on the initial setup screen。
3。 A series of dialog boxes will appear。 Select the defaults and click Next to continue
through the setup program。 In the final dialog box�察�click Install。
4。 After all the elements have been downloaded and installed�察�you may need to restart
your puter。
After Visual Basic Express is installed�察�you can start it by selecting it from the Start menu。
Choosing the Application Type
With Visual Basic Express running�察�you¨re ready to write your first application。 However�察 �
first you need to make a choice�此�what type of application will you write�拭�Broadly speaking�察�in
�察�you can develop three main types of programs�此 �
´´´´´´´´´´´´´´´´´´´´´´Page 26´´´´´´´´´´´´´´´´´´´´´´´
4 CH AP T E R 1 * R E A DY �察 �ST E A DY �察 �G O � �
o A console application is designed to run at the mand line with no graphical user
interface ��GUI��。
o A Windows application is designed to run on a user¨s desktop and has a GUI。
o A class library holds reusable functionality that can be used by console and Windows
applications。 It cannot be run by itself。
So that you know what each type of program is about�察�in this chapter�察�you will code all
three。 They are all variations of the Hello�察�World example�察�which displays the text ^hello�察�world ̄
on the screen。 Hello�察�World programs have been used for decades to demonstrate program
ming languages。
Creating Projects and Solutions
Regardless of which program type you are going to code�察�when using the Visual Studio line of
products�察�you will create projects and solutions�此�
o A project is a classification used to describe a type of application。
o A solution is a classification used to describe multiple applications that most likely
relate to each other。
Imagine building a car。 A project could be the steering wheel�察�engine�察�or car body。 Putting
all of the car projects together creates a plete solution called the car。
A solution contains projects。 For the examples in this chapter�察�our solution will contain
three projects representing each of the three different program types。
When using Visual Basic Express�察�creating a project implies creating a solution�察�because
creating an empty solution without a project does not make sense。 It¨s like building a car with
no parts。 When I say ^project ̄ or ^application ̄ in this book�察�from a workspace organization
perspective�察�it means the same thing。 Solution is an explicit reference to one or more projects
or applications。
Our plan of action in terms of projects and solutions in this chapter is as follows�此�
o Create the solution by creating a Windows application called WindowsApplication
��creating this application also creates a solution��。
o Add to the created solution a console application called ConsoleApplication。
o Add to the created solution a class library project called ClassLibrary。
Creating the Windows Application
We¨ll dive right in and start with the Windows application。 With Visual Basic Express running�察 �
follow these steps to create the Windows application�此�
1。 Select File New Project from the menu。
2。 Select the Windows Forms Application icon。 This represents a project style based on a
predefined template called Windows Forms Application。
´´´´´´´´´´´´´´´´´´´´´´Page 27´´´´´´´´´´´´´´´´´´´´´´´
C H AP TE R 1 * R E AD Y �察 �ST E AD Y �察 �G O� �5
3。 Change the default name to WindowsApplication。
4。 Click OK。
These steps create a new project and solution at the same time�此�Visual Basic Express will
display only the plete project�察�as shown in Figure 1´2。
Figure 1´2。 The Visual Basic Express IDE with the new WindowsApplication project
Viewing the Source Code
When you create a new application�察�Visual Basic Express automatically generates some source
code for it。 Right´click the Form1。vb item in the Solution Explorer and select View Code from
the context menu。 The following source code will appear in the area to the left of the Solution
Explorer。
*Note To shift between the user interface and generated code�察�right´click Form1。vb in the Solution Explorer。 A
submenu appears with the options View Code ��to see the code�� or View Designer ��to see the user interface��。
Public Class Form1
End Class
In Visual Basic�察�the source code is spartan because Visual Basic is what was once called a
rapid application development ��RAD�� environment。 The idea at the core of Visual Basic is the
ability to develop an application as quickly as possible without the esoteric details of the language
´´´´´´´´´´´´´´´´´´´´´´Page 28´´´´´´´´´´´´´´´´´´´´´´´
6 CH AP T E R 1 * R E A DY �察 �ST E A DY �察 �G O � �
getting in your way。 This legacy is both good and bad。 Figure 1´2 shows a simple project with a
single file�察�but another file exists at the hard disk level�察�as shown in Figure 1´3 ��you can see this
file by clicking the Show All Files icon in the Solution Explorer and expanding the Form1。vb node��。
Figure 1´3。 All files that make up the WindowsApplication project
In previous versions�察�the Form1。Designer。vb file used to be a binary file that you could not edit。
Now it is a text file that you can edit�察�but you should