Sunteți pe pagina 1din 17

Visual Basic

Chapter 1
Unit I
Introduction to GUI and Windows Programming
 GUI Concept & Tools

The Title Bar
 Menu System, Menus and the Menu Bar
 The Size Box
 System Menu Box
 Icons

Cursors
 Scroll Bars
 Tool Bar
 Client Area
GUI Concept & Tools
 A graphical user interface (GUI) is a user interface that
allows interaction with a computer on its graphical
components like window, text box, command buttons
etc.
 The GUI includes:
 The title bar

 Menu system, menus and the menu box

 The size box

 System menu box

 Icons

 Cursors

 Scroll bars

 Tool bar

 Client area
 Title Bar: The Title Bar shows the title of the window at
the top of the application as horizontal bar. The name of
the application and the name of the project you are
working on.
 Menu system, menus and the menu box: The user
friendly applications use menu system. This is a system
that provides a list of commands or options. The menus
are of two types

Contact sensitivity menu: are sensitive to the contact
of mouse pointer. Eg submenu etc
 Context sensitivity menu: are sensitive to the context

of your work. Eg in run mode some options are


available
 The Size Box: The size box is the box placed at the right
hand corner of the title bar. It is used to minimized,
maximized, and close the window.
 System Menu Box: System menu box or the control box
is placed at the top left corner of the title bar of the
window. It is needed to minimized, maximized, to
restore, to close it, to move the window.
 Icons: Icons are graphical depictions of various objects
in Microsoft window. The objects can be programs, files,
folders etc.
 Cursors: A cursor is a moving marker or pointer that
indicates a position. It changes shapes according the
area of visibility.
 Scroll Bars: A scroll bar is graphical object through which
continuous text, picture or any other object can be
viewed, if it doesn’t fit into the space of the monitor.
 Tool Bar: It contains tools or controls that can be
inserted in the project. For example text box, labels,
check boxes, command buttons. Etc
 Client Area: This area of the window is the working area
or usable area.
Windows Programming
 Windows includes all sorts of built-in functions and data
eg to draw text in different sizes & styles using font data.
Windows application programs make use of these built in
functions and do not need to supply the program logic to
do these tasks. Each program logic has its own
Application Programming Interface (API) and set of
design rules.
 An interface defines the communication boundary
between two entities such as piece of software, a
hardware device or a user. There are software interfaces
that are used for windows programming. They exists
between separate software components and provide a
programmatic mechanism by which these component
can communicate. These can include data types, types
of procedures, exception, specifications and method
signatures.
What is visual basic?
 Visual basic is a very powerful programming system that
helps to develop sophisticated, graphical application that
can be run on Microsoft Windows environment. Visual
basic consist of two parts viz. “Visual” and “Basic”. The
“Visual” part refers to the method used to create the
graphical user interface (GUI). The “Basic” part refers to
the BASIC language since visual basic is the descendent
of BASIC (Beginners All Purpose Symbolic Instruction
Code) which was often the first language used to learn
programming basics.
 Visual basic support event driven programming. A
program in general can be developed in three ways in
modular programming style or in object oriented
programming style and event driven programming style.
Features of Visual Basic
 VB is not just a language, but is an Integrated
Development Environment (IDE). VB environment is
very friendly which helps to create forms, add controls
to form and write code behind the form very quickly
and easily. It has many other features also.
 It is successor of BASIC language
 VB supports event driven programming. Every time the
user clicks a command button or presses the mouse,
an event stream is generated and code that has been
written behind the event is executed. After execution of
the code the control again comes back to the user.
 Common programming Platform: VB provides a
common programming platform across all MS-Office
applications.
 Internet based application. VB can be used to write
internet programs. VB can be extended to other
environment, it means objects developed in visual basic
can be used in other applications by the use of Active X
Controls
 Quick error detection/correction.
 ActiveX support.
 VB can create executable files, Active X controls, DLL
files but is primarily used to develop Windows
applications and to inter web database systems.
 Dialog boxes with less functionality can be used to
provide pop-up capabilities.
 Controls have attributes and event handlers associated
with them, default values are provided when the control
is created, but may be changed by the programmer.
 VB follows some of the object oriented concepts, every
thing in VB is an object. As the objects can be developed
separately, they can also be tested independently.
Visual Basic Environment
 There are certain steps to be followed while
developing a program in VB such as design,
editing, compiling and debugging within a
common environment.
 Click at Start button
 Click at Programs->Microsoft Visual Studio-
>Microsoft Visual Basic
 Select New Project dialog.
project in VB is a collection of several different
types of files that make up application.
Various types of projects are available VB as follows
 Standard EXE
 ActiveX EXE
 ActiveX DLL
 ActiveX Controls
 ActiveX Document EXE
 ActiveX Document DLL
 VB Application Wizard
 VB Wizard Manager
 Data Project
 DHTML Application
 Add in
 VB Enterprise Edition Controls
Visual Basic Integrated
Development Environment (IDE)
 Tool Box
 Form Designer
 Project Explorer Window
 Properties Window
 Menu Bar and Pull-down Menus
 Code Editor Window
 Standard Tool Bar
Docking the window in the IDE:- The windows in the VB
environment can be re-positioned or moved from its original
position to the position as required by the user. The new
position is not permanent. The movement of window is called
docking.
Visual Basic Application Modes
Visual Basic application works in three modes
Design mode, run mode and break/suspended mode
Important File Extensions…
 .vbg- Group project file which contains a list of
all projects in one group
 .vbp- Project file which has a list of all files and
components related to the project
 .frm- Forms modules file which contains the
textual information about the form, its controls &
their property setting
 .frx- Form data file which is a binary data file for
the form. It contains the information about the
pictures and icons.
 .bas- Standard module file which contains the
sub-procedures & function procedures.
Important File Extensions…
 .ocx- ActiveX control file which is used for
addition to the standard controls that can be
added to the toolbox.
 .cls- Class module file which contains the class
definition, its method and its procedures.
 .exe- ActiveX exe file or an out of process
component file, that provides reusable code.
 .dll- ActiveX dll file or an in process component
file that provide reusable codes.
VB Building Blocks
The VB toolbox contains the tools that you can to draw
controls on your forms. The controls that are always
included in toolbox are integral part of Standard Exe
projects are known as intrinsic controls.

 Object
 Properties
 Events
 Forms
 Controls
 Modules
 Methods
 Event procedures
 General procedures
Container Controls: A container is a control that can hold
other controls within it. Eg. A frame or a picture box or
simply your form. Controls inside a container are known
as child controls.
 Object:- A object can be said to be a programmable
entity, containing both code and data. This entity can
be treated & controlled as a unit.. Eg Text Box controls,
Frame controls, List Box controls etc. whenever the
object is used it must have name.
A controls name is one of its most important attribute.
While naming controls you need to take care of these
rules:

Must begin with a letter

Must contain only letters, numbers, and the
underscore; punctuation characters & spaces are
not allowed.

Must be no longer than 40 characters

S-ar putea să vă placă și