VISUAL BASIC
Introduction To Visual Basic
Visual Basic:
Third generation event-driven programming language.
Released by Microsoft in 1991.
Evolved from earlier dos version called “BASIC”.
BASIC – Beginners All-Purpose Symbolic Instruction Code.
To develop GUI windows applications.
Application For Programmers:
For Maths students you can create mathematical programs such as
1. Geometric Progression.
2. Quadratic Equation Solver.
3. Prime Number Tester.
4. Inventory management.
5. Multimedia player.
Starting VB:
Go to start menu -> Microsoft visual studio -> visual basic 6.0
After this visual basic environment opens.
Visual Basic Environment:
IT is an IDE (Integrated Development Environment).
An IDE normally consists of a source code editor, build automation
tools, and a debugger.
This programming environment used for developing a user interface.
Add control by just drag and drop.
This environment will allows to develop the .exe files.
Getting Started:
For Creating New Project Click, File -> New Project (OR) Use the
short cut key called ‘Ctrl + N’.
The dialog box appears in that we want to select ‘Standard EXE’
option.
The Screen looks like this,
Initial VB Screen:
After selecting Standard EXE option, The environment screen will
displays.
In this environment window you can see lots of elements such as
tool box, properties window, project explorer, initial form
window, form layout window, title bar, menu bar.
The initial Window looks like this,
You can save the project and as well as the form as separately.
Go to File-> save project or File -> Save Form.
If You Save the project it will save with .vb extension and If you
save the form it will save with .frm extension,
Title Bar
The Title Bar is the horizontal bar located at the top of the screen.
It is the name of the application.
Menu Bar
For Visual basic, menu bar gives you the tools needed for develop,
test and save your application.
File Menu – commands for working with files.
Edit Menu – Contains many of the editing tools which helps to
design your application
View Menu
Fast access to different parts of your program and visual basic
environment.
For going to code section press ‘F7’ Key and for design view Press
‘Shift + F7’ Key.
Project Menu
This menu allows you to insert external files or new vb objects into
your projects.
Format Menu
Used to specify the look of the controls that you placed in your
project.
Debug Menu
Contains tool for correct the bugs in your Code.
Start debugging by press ‘F8’ Key’.
Run Menu
Gives the tools needed to stop and start your program.
Run the program by pressing ‘F5’ Key.
Tools Menu
gives the way of adding procedures and menus to your programms.
Windows Menu
Lets you control how the windows of VB environment are arranged.
Help Menu
Gain access to the detailed online help system provide with VB.
Short cut key for view help ‘ctrl + F1’.
Tool Bars:
Tool bars display the functionality as icons.
Multiple tool bars are available.
There are 4 built-in toolbars, they are
1. Standard Tool Bar
2. Edit Tool Bar.
3. Debug Tool Bar.
4. Form Editor
1) Standard Tool Bar:
The Standard tool bar provides a quick shortcut to many frequently used
functions.
Below are some of the standard tools,
1. Add Standard Exe – Build a new executable.
2. Add Form – Add new form to your project.
3. Menu Editor – use to design menus.
4. Open Project – open an existing project.
5. Save Project – Save your VB project.
6. Start – use to run the application.
7. Break – use to pause the running program.
8. End – Ends the running program.
9. Project Explorer – Makes the project explorer visible.
2) Edit Tool Bar:
The Edit tool bar provides a quick shortcut to do modifications in the
form.
Below are some of the Edit tools,
1. Complete Word – Completes the Key word.
2. Indent – Indent the selected text one tab stop. ‘TAB’ key is the shortcut key
3. Outdent – Moves the selected text back one tab. ‘Shift + TAB’ key is the
shortcut.
4. Toggle breakpoint – Used for debugging. ‘F9’ is the shortcut key
5. Comment block.
6. Toggle bookmark.
7. List Properties / methods.
8. Quick info.
3) Debug Tool Bar:
The Debug tool bar provides a quick shortcut to debug or check the code
of your project.
Below are some of the Debug tools,
1. Start.
2. Break.
3. End.
4. Toggle breakpoint.
4) Form Editor Tool Bar:
The Form editor tool bar provides a quick shortcut to design the form
window.
Below are some of the Form editor tools,
1. Bring to Front.
2. Send To Back.
3. Align.
4. Center.
5. Lock Controls
Altering a Form
This means doing modifications to a form.
Before completing the design you can change the size and location
of a form.
Even you can resize the form window during runtime.
To change the position of form at run time, follow these steps,
1. Move the cursor to the Form Layout Window (The cursor will change
to four-headed arrow).
2. Drag the form to the position in which you want it to appear when the
user starts your program.