8/14/2019 V.B. Chapter 1
1/17
Visual BasicVisual BasicChapter 1Chapter 1
8/14/2019 V.B. Chapter 1
2/17
Unit IUnit I
Introduction to GUI and Windows ProgrammingIntroduction to GUI and Windows Programming GUI Concept & ToolsGUI Concept & Tools
The Title BarThe Title Bar
Menu System, Menus and the Menu BarMenu System, Menus and the Menu Bar
The Size BoxThe Size Box
System Menu BoxSystem Menu Box
IconsIcons
CursorsCursors Scroll BarsScroll Bars
Tool BarTool Bar
Client AreaClient Area
8/14/2019 V.B. Chapter 1
3/17
GUI Concept & ToolsGUI Concept & Tools
AA graphical user interface (GUI)graphical user interface (GUI) is a user interface thatis a user interface thatallows interaction with a computer on its graphicalallows interaction with a computer on its graphicalcomponents like window, text box, command buttonscomponents like window, text box, command buttonsetc.etc.
The GUI includes:The GUI includes:
The title barThe title bar Menu system, menus and the menu boxMenu system, menus and the menu box The size boxThe size box System menu boxSystem menu box IconsIcons CursorsCursors Scroll barsScroll bars Tool barTool bar Client areaClient area
8/14/2019 V.B. Chapter 1
4/17
8/14/2019 V.B. Chapter 1
5/17
Title BarTitle Bar: The Title Bar shows the title of the window at: The Title Bar shows the title of the window at
the top of the application as horizontal bar. The name ofthe top of the application as horizontal bar. The name of
the application and the name of the project you arethe application and the name of the project you are
working on.working on.
Menu system, menus and the menu box:Menu system, menus and the menu box: The userThe user
friendly applications use menu system. This is a systemfriendly applications use menu system. This is a system
that provides a list of commands or options. The menusthat provides a list of commands or options. The menus
are of two typesare of two types Contact sensitivity menuContact sensitivity menu:: are sensitive to the contactare sensitive to the contact
of mouse pointer. Eg submenu etcof mouse pointer. Eg submenu etc
Context sensitivity menuContext sensitivity menu:: are sensitive to the contextare sensitive to the context
of your work. Eg in run mode some options areof your work. Eg in run mode some options areavailableavailable
The Size Box:The Size Box: The size box is the box placed at the rightThe size box is the box placed at the right
hand corner of the title bar. It is used to minimized,hand corner of the title bar. It is used to minimized,
maximized, and close the window.maximized, and close the window.
8/14/2019 V.B. Chapter 1
6/17
System Menu BoxSystem Menu Box: System menu box or the control box: System menu box or the control boxis placed at the top left corner of the title bar of theis placed at the top left corner of the title bar of thewindow. It is needed to minimized, maximized, towindow. It is needed to minimized, maximized, to
restore, to close it, to move the window.restore, to close it, to move the window. Icons:Icons: Icons are graphical depictions of various objectsIcons are graphical depictions of various objects
in Microsoft window. The objects can be programs, files,in Microsoft window. The objects can be programs, files,folders etc.folders etc.
Cursors:Cursors: A cursor is a moving marker or pointer thatA cursor is a moving marker or pointer that
indicates a position. It changes shapes according theindicates a position. It changes shapes according thearea of visibility.area of visibility. Scroll BarsScroll Bars: A scroll bar is graphical object through which: A scroll bar is graphical object through which
continuous text, picture or any other object can becontinuous text, picture or any other object can beviewed, if it doesnt fit into the space of the monitor.viewed, if it doesnt fit into the space of the monitor.
Tool BarTool Bar: It contains tools or controls that can be: It contains tools or controls that can beinserted in the project. For example text box, labels,inserted in the project. For example text box, labels,check boxes, command buttons. Etccheck boxes, command buttons. Etc
Client AreaClient Area: This area of the window is the working area: This area of the window is the working areaor usable area.or usable area.
8/14/2019 V.B. Chapter 1
7/17
Windows ProgrammingWindows Programming
Windows includes all sorts of built-in functions and dataWindows includes all sorts of built-in functions and dataeg to draw text in different sizes & styles using font data.eg to draw text in different sizes & styles using font data.Windows application programs make use of these built inWindows application programs make use of these built infunctions and do not need to supply the program logic tofunctions and do not need to supply the program logic todo these tasks. Each program logic has its owndo these tasks. Each program logic has its ownApplication Programming Interface (API) and set ofApplication Programming Interface (API) and set ofdesign rules.design rules.
An interface defines the communication boundaryAn interface defines the communication boundarybetween two entities such as piece of software, abetween two entities such as piece of software, ahardware device or a user. There are software interfaceshardware device or a user. There are software interfacesthat are used for windows programming. They existsthat are used for windows programming. They exists
between separate software components and provide abetween separate software components and provide aprogrammatic mechanism by which these componentprogrammatic mechanism by which these componentcan communicate. These can include data types, typescan communicate. These can include data types, typesof procedures, exception, specifications and methodof procedures, exception, specifications and methodsignatures.signatures.
8/14/2019 V.B. Chapter 1
8/17
What is visual basic?What is visual basic?
Visual basic is a very powerful programming system thatVisual basic is a very powerful programming system thathelps to develop sophisticated, graphical application thathelps to develop sophisticated, graphical application thatcan be run on Microsoft Windows environment. Visualcan be run on Microsoft Windows environment. Visualbasic consist of two parts viz. Visual and Basic. Thebasic consist of two parts viz. Visual and Basic. TheVisual part refers to the method used to create theVisual part refers to the method used to create the
graphical user interface (GUI). The Basic part refers tographical user interface (GUI). The Basic part refers tothe BASIC language since visual basic is the descendentthe BASIC language since visual basic is the descendentof BASIC (Beginners All Purpose Symbolic Instructionof BASIC (Beginners All Purpose Symbolic InstructionCode) which was often the first language used to learnCode) which was often the first language used to learnprogramming basics.programming basics.
Visual basic support event driven programming. AVisual basic support event driven programming. Aprogram in general can be developed in three ways inprogram in general can be developed in three ways inmodular programming style or in object orientedmodular programming style or in object orientedprogramming style and event driven programming style.programming style and event driven programming style.
8/14/2019 V.B. Chapter 1
9/17
Features of Visual BasicFeatures of Visual Basic
VB is not just a language, but is an IntegratedVB is not just a language, but is an IntegratedDevelopment Environment (IDE). VB environment isDevelopment Environment (IDE). VB environment isvery friendly which helps to create forms, add controlsvery friendly which helps to create forms, add controlsto form and write code behind the form very quicklyto form and write code behind the form very quicklyand easily. It has many other features also.and easily. It has many other features also.
It is successor of BASIC languageIt is successor of BASIC language VB supports event driven programming. Every time theVB supports event driven programming. Every time the
user clicks a command button or presses the mouse,user clicks a command button or presses the mouse,an event stream is generated and code that has beenan event stream is generated and code that has been
written behind the event is executed. After execution ofwritten behind the event is executed. After execution ofthe code the control again comes back to the user.the code the control again comes back to the user. Common programming Platform: VB provides aCommon programming Platform: VB provides a
common programming platform across all MS-Officecommon programming platform across all MS-Officeapplications.applications.
8/14/2019 V.B. Chapter 1
10/17
Internet based application. VB can be used to writeInternet based application. VB can be used to writeinternet programs. VB can be extended to otherinternet programs. VB can be extended to otherenvironment, it means objects developed in visual basicenvironment, it means objects developed in visual basic
can be used in other applications by the use of Active Xcan be used in other applications by the use of Active XControlsControls
Quick error detection/correction.Quick error detection/correction. ActiveX support.ActiveX support. VB can create executable files, Active X controls, DLLVB can create executable files, Active X controls, DLL
files but is primarily used to develop Windowsfiles but is primarily used to develop Windowsapplications and to inter web database systems.applications and to inter web database systems.
Dialog boxes with less functionality can be used toDialog boxes with less functionality can be used toprovide pop-up capabilities.provide pop-up capabilities.
Controls have attributes and event handlers associatedControls have attributes and event handlers associatedwith them, default values are provided when the controlwith them, default values are provided when the controlis created, but may be changed by the programmer.is created, but may be changed by the programmer.
VB follows some of the object oriented concepts, everyVB follows some of the object oriented concepts, everything in VB is an object. As the objects can be developedthing in VB is an object. As the objects can be developedseparately, they can also be tested independently.separately, they can also be tested independently.
8/14/2019 V.B. Chapter 1
11/17
Visual Basic EnvironmentVisual Basic Environment
There are certain steps to be followed whileThere are certain steps to be followed whiledeveloping a program in VB such as design,developing a program in VB such as design,
editing, compiling and debugging within aediting, compiling and debugging within a
common environment.common environment.
Click at Start buttonClick at Start button
Click at Programs->Microsoft Visual Studio-Click at Programs->Microsoft Visual Studio-
>Microsoft Visual Basic>Microsoft Visual Basic
Select New Project dialog.Select New Project dialog.
project in VB is a collection of several differentproject in VB is a collection of several different
types of files that make up application.types of files that make up application.
8/14/2019 V.B. Chapter 1
12/17
Various types of projects are available VB as followsVarious types of projects are available VB as follows Standard EXEStandard EXE ActiveX EXEActiveX EXE ActiveX DLLActiveX DLL ActiveX ControlsActiveX Controls ActiveX Document EXEActiveX Document EXE ActiveX Document DLLActiveX Document DLL VB Application WizardVB Application Wizard VB Wizard ManagerVB Wizard Manager Data ProjectData Project DHTML ApplicationDHTML Application Add inAdd in VB Enterprise Edition ControlsVB Enterprise Edition Controls
8/14/2019 V.B. Chapter 1
13/17
Visual Basic IntegratedVisual Basic Integrated
Development Environment (IDE)Development Environment (IDE) Tool BoxTool Box Form DesignerForm Designer Project Explorer WindowProject Explorer Window Properties WindowProperties Window Menu Bar and Pull-down MenusMenu Bar and Pull-down Menus
Code Editor WindowCode Editor Window Standard Tool BarStandard Tool Bar
Docking the window in the IDE:-Docking the window in the IDE:- The windows in the VBThe windows in the VBenvironment can be re-positioned or moved from its originalenvironment can be re-positioned or moved from its originalposition to the position as required by the user. The newposition to the position as required by the user. The new
position is not permanent. The movement of window is calledposition is not permanent. The movement of window is calleddocking.docking.
Visual Basic Application ModesVisual Basic Application Modes
Visual Basic application works in three modesVisual Basic application works in three modes
Design mode, run mode and break/suspended modeDesign mode, run mode and break/suspended mode
8/14/2019 V.B. Chapter 1
14/17
Important File ExtensionsImportant File Extensions
.vbg- Group project file which contains a list of.vbg- Group project file which contains a list ofall projects in one groupall projects in one group .vbp- Project file which has a list of all files and.vbp- Project file which has a list of all files and
components related to the projectcomponents related to the project
.frm- Forms modules file which contains the
.frm- Forms modules file which contains thetextual information about the form, its controls &textual information about the form, its controls &their property settingtheir property setting
.frx- Form data file which is a binary data file for.frx- Form data file which is a binary data file forthe form. It contains the information about thethe form. It contains the information about the
pictures and icons.pictures and icons. .bas- Standard module file which contains the.bas- Standard module file which contains the
sub-procedures & function procedures.sub-procedures & function procedures.
8/14/2019 V.B. Chapter 1
15/17
Important File ExtensionsImportant File Extensions
..ocx- ActiveX control file which is used forocx- ActiveX control file which is used foraddition to the standard controls that can beaddition to the standard controls that can beadded to the toolbox.added to the toolbox.
.cls- Class module file which contains the class.cls- Class module file which contains the classdefinition, its method and its procedures.definition, its method and its procedures. .exe- ActiveX exe file or an out of process.exe- ActiveX exe file or an out of process
component file, that provides reusable code.component file, that provides reusable code.
.dll- ActiveX dll file or an in process component.dll- ActiveX dll file or an in process componentfile that provide reusable codes.file that provide reusable codes.
8/14/2019 V.B. Chapter 1
16/17
VB Building BlocksVB Building Blocks
The VB toolbox contains the tools that you can to drawThe VB toolbox contains the tools that you can to drawcontrols on your forms. The controls that are alwayscontrols on your forms. The controls that are alwaysincluded in toolbox are integral part of Standard Exeincluded in toolbox are integral part of Standard Exeprojects are known as intrinsic controls.projects are known as intrinsic controls.
ObjectObject PropertiesProperties EventsEvents FormsForms
ControlsControls ModulesModules MethodsMethods Event proceduresEvent procedures
General proceduresGeneral procedures
8/14/2019 V.B. Chapter 1
17/17
Container Controls:Container Controls: A container is a control that can holdA container is a control that can holdother controls within it. Eg. A frame or a picture box orother controls within it. Eg. A frame or a picture box orsimply your form. Controls inside a container are knownsimply your form. Controls inside a container are known
as child controls.as child controls. Object:-Object:- A object can be said to be a programmableA object can be said to be a programmable
entity, containing both code and data. This entity canentity, containing both code and data. This entity canbe treated & controlled as a unit.. Eg Text Box controls,be treated & controlled as a unit.. Eg Text Box controls,Frame controls, List Box controls etc. whenever theFrame controls, List Box controls etc. whenever the
object is used it must have name.object is used it must have name.A controls name is one of its most important attribute.A controls name is one of its most important attribute.While naming controls you need to take care of theseWhile naming controls you need to take care of theserules:rules:
Must begin with a letterMust begin with a letter Must contain only letters, numbers, and theMust contain only letters, numbers, and theunderscore; punctuation characters & spaces areunderscore; punctuation characters & spaces arenot allowed.not allowed.
Must be no longer than 40 charactersMust be no longer than 40 characters