Professional Documents
Culture Documents
CHAPTER-1 Contents
Starting Out with Visual Basic
1. 2. 3. 4. What is a Computer Program?. Computer Programs and Programming Languages. Visual Basic Is a Smart Language. How Design Fits into the Programming Process
Microsofts Visual Basic product is defined as a programming system. Simply put this programming system is used to write Windows-based computer programs; it includes the Visual Basic language as well as a number of tools that help you write these programs.
The key steps in creating a computer program are as follows: 1. Plan the programs tasks (how it should work). 2. Design the user interface (how it should look). 3. Write the programs code (implement steps 1 and 2). 4. Test and debug the program (including beta testing with users outside of the development team, if appropriate). 5. Document and distribute the program (put it in use).
Program Design
The design process should produce the following results: A concise list of tasks to be performed by the program. Deadlines for when particular tasks need to be completed. Clarification of the dependence of one part of the program on another. The criteria for testing the program.
CHAPTER-2 Contents
Creating Your First Program
1. 2. 3. 4. 5. Creating Your Programs User Interface Getting Information From the User Changing a Forms Properties Coding Your Programs Actions Running Your Program
Getting Started
Lets begin by creating a new project. A project is simply a set of files that store information about the components that make up an application (program). To create a Visual Basic program, you customize your projects various components. To get started with the Loan Calculator program, start Visual Basic; you will see the New Project dialog box shown in Fig2 C:2. If Visual basic is already running, or if you dont see the New Project dialog, choose File, New Project (see Fig3 C:2.).
Fig1 C:2
Fig2 C:2
Fig3 C:2
Fig4 C:2
The New Project dialog box enables you to specify the type of project you want to create. For the Loan Calculator project, select the Standard EXE option and click OK. You will then be placed in Visual Basics design environment, as illustrated in Fig4 C:2. First off, notice Visual Basics title bar - specifically, the word design. This means that you are in Design mode, also known as design time, a name for the time you spend designing your program. Later, when you run your program, Visual Basic will be in Run mode. As you see, a new Standard EXE project consists of one form, or window, which will usually be your programs main user interface. Visual Basic applications are comprised of one or more components, such as forms, code modules and classes, along with controls and other components.
Fig5 C:2
Look at the Project Explorer (illustrated in Fig5 C:2). It consists of a list of the contents of the current project. Because youve just begun this project, it only contains a single form named Form1, which is located in the Forms folder of the project (named Project1 by default). A project can grow to include many components; the Project Explorer helps keep them organized. To save a project, choose File, Save Project from the Visual Basic menu system, or simply click the Save Project button on the toolbar. The first time you save the project, (or after you subsequently add any files to the project) youll be led through one or more of the Save File As dialog boxes (see Fig6 C:2), one for each of the project components, and then a Save Project As dialog box for the project file. You specify the name and location of each file where the components (and project) are to be saved. Subsequent Save Project operations simply resave the components using the same filenames as before. Then you can easily execute frequent, quick saves of a previously saved project by clicking the Save Project button. If one or more components have been added to the project since it was last saved, the Save File As dialog box will be presented for each new component.