SlideShare a Scribd company logo
1 of 15
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

Similar to Ms visual-basic-6

ASP.NET Session 3
ASP.NET Session 3ASP.NET Session 3
ASP.NET Session 3
Sisir Ghosh
 
Rich Internet Applications and Flex - 1
Rich Internet Applications and Flex - 1Rich Internet Applications and Flex - 1
Rich Internet Applications and Flex - 1
Vijay Kalangi
 
Vb.net session 02
Vb.net session 02Vb.net session 02
Vb.net session 02
Niit Care
 
Dot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement onlineDot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement online
Garuda Trainings
 
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Shyamala Prayaga
 

Similar to Ms visual-basic-6 (20)

Lec02
Lec02Lec02
Lec02
 
Lec02
Lec02Lec02
Lec02
 
Forms 6i guide
Forms 6i guideForms 6i guide
Forms 6i guide
 
Object Oriented Programming I
Object Oriented Programming IObject Oriented Programming I
Object Oriented Programming I
 
forms
formsforms
forms
 
ASP.NET Session 3
ASP.NET Session 3ASP.NET Session 3
ASP.NET Session 3
 
Rich Internet Applications and Flex - 1
Rich Internet Applications and Flex - 1Rich Internet Applications and Flex - 1
Rich Internet Applications and Flex - 1
 
Vb.net session 02
Vb.net session 02Vb.net session 02
Vb.net session 02
 
Dot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement onlineDot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement online
 
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
 
Skill Development 2.pptx
Skill Development 2.pptxSkill Development 2.pptx
Skill Development 2.pptx
 
Visual COBOL Development for Windows & .Net
Visual COBOL Development for Windows & .NetVisual COBOL Development for Windows & .Net
Visual COBOL Development for Windows & .Net
 
Framework Enabling End-Users to Maintain Web Applications (ICICWS2015)
Framework Enabling End-Users to Maintain Web Applications (ICICWS2015)Framework Enabling End-Users to Maintain Web Applications (ICICWS2015)
Framework Enabling End-Users to Maintain Web Applications (ICICWS2015)
 
SAP ABAP + CRM7.0 with Course Content
SAP ABAP + CRM7.0 with Course ContentSAP ABAP + CRM7.0 with Course Content
SAP ABAP + CRM7.0 with Course Content
 
The Joy of Subforms with Randy Carey
The Joy of Subforms with Randy CareyThe Joy of Subforms with Randy Carey
The Joy of Subforms with Randy Carey
 
MS ACCESS
MS ACCESSMS ACCESS
MS ACCESS
 
Embedded systems robotics and this mva training series
Embedded systems robotics and this mva training seriesEmbedded systems robotics and this mva training series
Embedded systems robotics and this mva training series
 
Ontimize Application Framework
Ontimize Application FrameworkOntimize Application Framework
Ontimize Application Framework
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development Concepts
 

Recently uploaded

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Recently uploaded (20)

How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 

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