Site hosted by Angelfire.com: Build your free website today!

EXTRA INFO

Getting Started with VB6

Removing the form

Object Orientated programming (OOPS)

Getting to the Next Lesson

LEVEL 2

LEVEL 3

 

 

 

 

VISUAL BASIC 6

lesson 1 - Introduction to the workspace

AIM - To Understand How to Use the VB6 Workspace

 
Defining basic terms

Application

An application is a collection of objects that work together to accomplish something useful. In VB the application is called a Project. A Project could be a the management of a music store, the calculation of mortgages, or the Payroll for 1000+ employees. An object is a piece of software that has properties and functions that can be changed or manipulated. You're here so, you must be somewhat familiar with the Windows environment. A window is an object. It has properties: size, color, position on the screen, etc. (We could talk about a class rather than an object but, at this point we just want to keep it simple, and the underlying concept is the same).

The window has functions, also called methods, that can be manipulated: change the size, move it around, open it and close it. You do not have to write code to resize a window - you just click and drag. But somebody had to write code at some point. Fortunately for us, when they did they put it all in a nice little package and called it a window object. Now, whenever you need a window in your Project you can make a copy of the window object, change its properties for color or size very easily, and paste it where you want it. Then you can use its built-in methods to open it, close it when you want or resize it whenever necessary. When you create an application using objects and combining them to produce results, you are working in an object-oriented environment.

Event-driven

To produce an application in a procedural language such as COBOL or Pascal, you write source programs, compile them into machine code and then you run them via a control interface such as JCL. In a VB project, the processes that occur have to be associated with events. An event is something that happens - the user clicks on a button, a form is opened etc. The operation is event-driven because everything that executes does so as the result of some kind of event.

The role of the programmer is to anticipate the events and to write the code that will be executed when the event occurs. A VB application is interactive in the sense that the user is constantly interacting with the program. So VB6 is an event-driven programming language in an object orientated environment.

Open the Visual Basic (VB) Programming Environment. Start >> Programs>> Visual Basic 6. Open a new Standard EXE file. At first, the workspace appears quite complex.

To save your form use the drop down File Menu on the menu toolbar. File>> Save Form As, browse to your documents and create a VB Work folder. Save your form as FirstForm to this folder. Once you have saved the form note that the Project must also be saved. If you check the Project window you’ll see that the Project is the outer folder and the form is inside the Project folder.

Programs can have many forms but for now you will be learning how to code in a module window. In level 2, we will learn how to use the form to create a Graphical User Interface or GUI for a user. When you see a link like this it is a link to more information, you should click on the link and read the info.

The program we will create is a simple input output game using message and input boxes. This exercise is designed so that you learn how to use the VB environment. Do not worry about the code – that will be given to you to copy and paste. At this stage you are not expected to understand why the code works although you may be able to understand some of it. During Tutorial 2 you will begin to code your own programs but for now just learn where things are and where you put them. Just understanding how the workspace functions is the goal of this tutorial.

It is suggested that you close the Form Layout window and extend the Properties window as shown below.

Look at the pictures above and learn the locations and appearance of

  1. The Toolbox = ?
  2. The Form = ?
  3. The Project Window = ?
  4. The Properties Window = ?
  5. The Standard and Menu Toolbars = ?

When you are sure you know these five areas well, click the link below to the next page.

Next