SlideShare a Scribd company logo
MS Visual Basic 6
Walter Milner
VB 6
• 0 Introduction
– background to VB, A hello World program
• 1 Core language 1
– Projects, data types, variables, forms, controls , a calculator program
• 2 Core language 2
– Conditional statements, exception handling, loops, arrays, debugging
• 3 Core language 3
– Functions, sub-routines, parameter passing, modules, scope, lifetime
• 4 Controls
– scrollbar, radio buttons, checkboxes, listboxes, timers, control arrays
• 5 Graphics
– primitives and image files
• 6 Forms
– Forms MDI, menus
• 7 Files and databases
– adding controls, using data files, using databases
• 8 Deployment
Hello World in VB
• Start VB
• New Project – Standard .exe
• Click the Button control on the ToolBox
and drag in the form
• Double click the new button to invoke
the code editor
• Enter code:
• Click the Run button
Private Sub Command1_Click()
MsgBox ("Hello world")
End Sub
Exercise – try this out
What is Visual Basic?
• Kemeny and Kurtz – Dartmouth
College 1964
• For students – simple interpreted
• Many versions since
• MS VB versions – more power
not so simple
• VBScript VBA .NET framework
• RAD especially of user interface
A very early version
VB is not..
• Vendor independent
• Platform independent
• Based on a constant language definition
• Separated definition and IDE implementation
• Well documented
• (IMO) suitable for very large projects which must
be maintained over a long period of time
VB is ..
• easy to use
• suitable for RAD
• very marketable
Building an application - steps
• Commercial – data driven – waterfall
model – project management
• Science/engineering – underlying data
and physical model, algorithms, testing
• In VB – RAD – focus on user interface
prototyping and review.
Building an application - forms
• VB uses 'form' to mean Window
• Info on form stored in a .frm file
• VB system draws form based on that info
• Forms can be treated like classes in OOP
- later
Building an application - controls
• Buttons, text boxes, labels, check boxes..
• VB 'control' = user interface widget
• Some invisible – timer
• Controls have properties eg background
color
• Three kinds –
– standard
– non-standard MS controls (common dialog, tab)
and 3rd
party
– ActiveX controls written in-house
Building an application - modularity
• Spaghetti programming, structured
programming, OOP = increasing modularity
• In VB application constructed from modules
= files in project-
• Form modules
• BASIC modules
• Class modules
• Private and public control interaction
between modules
Building an application - objects
• Some OOP in VB – not pure OOP
• objects = things eg a form
• class = type of object eg a form design
• property = data value associated with
object
• method = something the object can do
Building an application – example of OOP
Dim f As Form2
Set f = New Form2
f.Show
f.BackColor = RGB(255, 0, 0)
Form2 is a class
f is an object – an instance of
class Form2
the Form2 class has a method called show
It has a property called
BackColor
Event-driven programming
• Standard approach for GUIs
• Contrast with old character interfaces – program
determines what happens
• In GUI, the user triggers what application does
(mostly)
• Event examples are key press, mouse move, timer
timeouts
• Correspond to native Windows Messages (next
slide)
• Event handler = a subroutine which will execute
when that event happens
Windows Messages – Spy++

More Related Content

PPT
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
PDF
Vb 6ch123
PPTX
Vb 6.0 controls
PPTX
VB Function and procedure
DOC
PPTX
Vb decision making statements
PPSX
Control Structures in Visual Basic
PPTX
Visual basic 6
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Vb 6ch123
Vb 6.0 controls
VB Function and procedure
Vb decision making statements
Control Structures in Visual Basic
Visual basic 6

Similar to Ms visual-basic-6 (20)

PPT
Lec02
PPT
PPTX
Forms 6i guide
PPTX
Object Oriented Programming I
PPTX
UNIT - 1 VISUAL BASIC PRESENTATION FOR IT
PPT
ASP.NET Session 3
KEY
Rich Internet Applications and Flex - 1
PPTX
TVL ICT_Introduction to Visual Basic.pptx
PPS
Vb.net session 02
PPT
Dot net Online Training | .Net Training and Placement online
PDF
Adobe Flex - Developing Rich Internet Application Workshop Day 2
PPTX
Presentation1.pptx
PPTX
Skill Development 2.pptx
PPTX
Visual COBOL Development for Windows & .Net
PDF
Framework Enabling End-Users to Maintain Web Applications (ICICWS2015)
PPTX
Introduction to Model-View-Controller Framework.pptx
PDF
SAP ABAP + CRM7.0 with Course Content
PDF
The Joy of Subforms with Randy Carey
PPTX
Lec02
Forms 6i guide
Object Oriented Programming I
UNIT - 1 VISUAL BASIC PRESENTATION FOR IT
ASP.NET Session 3
Rich Internet Applications and Flex - 1
TVL ICT_Introduction to Visual Basic.pptx
Vb.net session 02
Dot net Online Training | .Net Training and Placement online
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Presentation1.pptx
Skill Development 2.pptx
Visual COBOL Development for Windows & .Net
Framework Enabling End-Users to Maintain Web Applications (ICICWS2015)
Introduction to Model-View-Controller Framework.pptx
SAP ABAP + CRM7.0 with Course Content
The Joy of Subforms with Randy Carey
Ad

Recently uploaded (20)

PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Lesson notes of climatology university.
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
Cell Types and Its function , kingdom of life
PPTX
Cell Structure & Organelles in detailed.
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
RMMM.pdf make it easy to upload and study
PDF
Computing-Curriculum for Schools in Ghana
PDF
01-Introduction-to-Information-Management.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Pharma ospi slides which help in ospi learning
Lesson notes of climatology university.
Basic Mud Logging Guide for educational purpose
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Sports Quiz easy sports quiz sports quiz
Cell Types and Its function , kingdom of life
Cell Structure & Organelles in detailed.
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
GDM (1) (1).pptx small presentation for students
RMMM.pdf make it easy to upload and study
Computing-Curriculum for Schools in Ghana
01-Introduction-to-Information-Management.pdf
O7-L3 Supply Chain Operations - ICLT Program
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Microbial disease of the cardiovascular and lymphatic systems
Renaissance Architecture: A Journey from Faith to Humanism
Module 4: Burden of Disease Tutorial Slides S2 2025
FourierSeries-QuestionsWithAnswers(Part-A).pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Ad

Ms visual-basic-6

  • 1. MS Visual Basic 6 Walter Milner
  • 2. VB 6 • 0 Introduction – background to VB, A hello World program • 1 Core language 1 – Projects, data types, variables, forms, controls , a calculator program • 2 Core language 2 – Conditional statements, exception handling, loops, arrays, debugging • 3 Core language 3 – Functions, sub-routines, parameter passing, modules, scope, lifetime • 4 Controls – scrollbar, radio buttons, checkboxes, listboxes, timers, control arrays • 5 Graphics – primitives and image files • 6 Forms – Forms MDI, menus • 7 Files and databases – adding controls, using data files, using databases • 8 Deployment
  • 3. Hello World in VB • Start VB • New Project – Standard .exe • Click the Button control on the ToolBox and drag in the form • Double click the new button to invoke the code editor • Enter code: • Click the Run button Private Sub Command1_Click() MsgBox ("Hello world") End Sub Exercise – try this out
  • 4. What is Visual Basic? • Kemeny and Kurtz – Dartmouth College 1964 • For students – simple interpreted • Many versions since • MS VB versions – more power not so simple • VBScript VBA .NET framework • RAD especially of user interface
  • 5. A very early version
  • 6. VB is not.. • Vendor independent • Platform independent • Based on a constant language definition • Separated definition and IDE implementation • Well documented • (IMO) suitable for very large projects which must be maintained over a long period of time
  • 7. VB is .. • easy to use • suitable for RAD • very marketable
  • 8. Building an application - steps • Commercial – data driven – waterfall model – project management • Science/engineering – underlying data and physical model, algorithms, testing • In VB – RAD – focus on user interface prototyping and review.
  • 9. Building an application - forms • VB uses 'form' to mean Window • Info on form stored in a .frm file • VB system draws form based on that info • Forms can be treated like classes in OOP - later
  • 10. Building an application - controls • Buttons, text boxes, labels, check boxes.. • VB 'control' = user interface widget • Some invisible – timer • Controls have properties eg background color • Three kinds – – standard – non-standard MS controls (common dialog, tab) and 3rd party – ActiveX controls written in-house
  • 11. Building an application - modularity • Spaghetti programming, structured programming, OOP = increasing modularity • In VB application constructed from modules = files in project- • Form modules • BASIC modules • Class modules • Private and public control interaction between modules
  • 12. Building an application - objects • Some OOP in VB – not pure OOP • objects = things eg a form • class = type of object eg a form design • property = data value associated with object • method = something the object can do
  • 13. Building an application – example of OOP Dim f As Form2 Set f = New Form2 f.Show f.BackColor = RGB(255, 0, 0) Form2 is a class f is an object – an instance of class Form2 the Form2 class has a method called show It has a property called BackColor
  • 14. Event-driven programming • Standard approach for GUIs • Contrast with old character interfaces – program determines what happens • In GUI, the user triggers what application does (mostly) • Event examples are key press, mouse move, timer timeouts • Correspond to native Windows Messages (next slide) • Event handler = a subroutine which will execute when that event happens