SlideShare a Scribd company logo
MICROSOFT
VISUAL BASIC
A Brief History of Basic
· Language developed in early 1960's at
   Dartmouth College:
B (eginner's)
A (All-Purpose)
S (Symbolic)
I (Instruction)
C (Code)
· Answer to complicated programming
   languages (FORTRAN, Algol, Cobol ...).
First timeshare language.
A Brief History of Basic
. In the mid-1970's, two college students
   write first Basic for a microcomputer
  (Altair) - cost $350 on cassette tape.
   You may have heard of them:
   Bill Gates and Paul Allen!

· Every Basic since then essentially based
  on that early version. Examples include:
  GW-Basic, QBasic, QuickBasic.

· Visual Basic was introduced in 1991.
Visual Basic versions
Visual Basic 6.0 versus Other Versions of Visual
    Basic
· The original Visual Basic for DOS and Visual Basic
    For Windows were
introduced in 1991.
· Visual Basic 3.0 (a vast improvement over previous
    versions) was released in
1993.

· Visual Basic 4.0 released in late 1995 (added 32 bit
   application support).
·
·
Visual Basic versions
Visual Basic 5.0 released in late 1996. New
   environment, supported creation of
ActiveX controls, deleted 16 bit application support.

· And, now Visual Basic 6.0 - some identified new
  features of Visual Basic 6.0:
Þ Faster compiler
Þ New ActiveX data control object
Þ Allows database integration with wide variety of
  applications
Þ New data report designer
Þ New Package & Deployment Wizard
Þ Additional internet capabilities
What is Visual Basic ?
  • A high level programming language
  • Created by Microsoft
  • Uses a graphic environment called
    Integrated Development Environment
    (IDE)
  • Capable of developing Windows-based
    applications and games
  • Event –driven language
  • Made up of many subprograms , each
    with its own codes that can run
    independently, and at the same time
    can be linked together
DEFINITION OF TERMS
1. Application - collection of objects that
works together to accomplish a certain task/s
for its users
Examples: MS Word, Adobe Photoshop, Corel
Draw

2. Project - the term used in Visual Basic
pertaining to Application
Examples: Payroll System, Quiz Bee Scoring
Program
DEFINITION OF TERMS

3. Object– a piece of software
that has properties and functions
that can be managed or
controlled
Examples: window, dialog box
DEFINITION OF TERMS

4. Property – characteristic of an object
Examples: color, size, background

5. Method – functions of an object that can
be manipulated
Examples: opening, resizing, moving (of a
window)
DEFINITION OF TERMS

6.Object-Oriented Environment – a place
wherein application is created using objects
and combining them to produce an output

7. Event – an action that happens
Examples: clicking of a button, clicking of
a menu, loading of form
DEFINITION OF TERMS
8. Event- Driven – an operation is executed
as the result of some kind of event
9. Form – the first object you will see on
     the screen when you open Visual
Basic
  - it is where all the controls are placed
  - it is also where you will enter data and
    see the results
10. Controls –the object you put on a form
Examples: text box, label, command
DEFINITION OF TERMS
11. Code -computer instructions written by the
programmer
   indicates what the action or result will be when an
     event occurs
Examples: getting the total of 2 numbers once
the button is clicked pop-up message appear
12.Script – other name for code

13. Design time - time when you visually design and
layout the forms and object in it

14. Run Time - time when the program is executed
Why is operation event –driven?
The Main Window consists of the
title bar, menu bar, and toolbar.

Title bar indicates the project name,
the current Visual Basic operating
mode, and the current form.

Menu bar has drop-down menus from
which you control the operation of the
Visual Basic environment.
 Toolbar has buttons that provide
  shortcuts to some of the menu
  options.
 The Main window also shows the
  location of the current form relative to
  the upper left corner of the screen
  (measured in twips) and the width
  and length of the current form.
The Form Window is central to developing
Visual Basic applications.
It is where you draw your application.
The Toolbox is the selection menu for controls
used in your application.
The Properties Window is used
to establish initial property
values for
objects. The drop-down box at the top
of the window lists all objects in the
current form.
Two views are available: Alphabetic
and Categorized. Under this box
are the available properties for the
currently selected object.
The Form Layout Window shows where (upon
program execution) your form will be displayed
relative to your monitor’s screen:
The Project Window displays a list of
all forms and modules making up
your application. You can also obtain a view
of the Form or Code windows (window
containing the actual Basic coding) from the
Project window.
Project Window
Take note:
Properties Window
Alignment = how text aligns in the control
Back Color = choose the color of the
background
Caption = the text that will appear in the
control
Font = choose the font type and size
Fore Color = choose the color of the text
(foreground)
                      Remember: Save the project as often as
                                it should be.
To switch between the Code window and the Form
window, use the buttons just over the Project Explorer
window (diagram on the left).
Tips on Improving your
               application
-write the simplest program that you understand and make it
work - even if it doesn't have color or fancy fonts, test it and then
save it;

-make a copy of your previous working program and code one or
two improvements in the copy

- repeat for every improvement you make, using small steps so
that if something does go wrong its easier to identify the source
of the problem
Avoid repeating code!

The way to correct the application is to take all
the code that repeats and put it into a separate
procedure.

A procedure is identified by the Private Sub ...
End Sub lines.

Call the procedure simply by writing its name.
Writing code
Code Editor
Cut, Copy, Paste, Find, Replace
GOOD HABITS:
1.Use comments
2.Use indents
3.Use standard capitalization
4.Write extra-long statements on 2
lines using the continuation
character _ (space underscore)
VARIABLES
   AND
CONSTANT
    S
Variables and Constants
VARIABLE
 are used by Visual Basic to hold information
  needed by your application
 sign or a name that stands for a particular
  value in a program
 may store a data while the program is running
Naming Conventions
These are the rules to follow when naming
elements in VB - variables, constants, controls,
procedures, and so on:

A name must begin with a letter.

May be as much as 255 characters
Naming Conventions
 Must not contain a space or an embedded
  period or type-declaration characters used to
  specify a data type ; these are ! # % $ & @
 Must not be a reserved word (that is part of the
  code, like Option, for example).
 The dash, although legal, should be avoided
  because it may be confused with the minus sign.
  Instead of Family-name use Familyname or
  FamilyName.
Declaring Variables

Explicit Declaration – variable is declared at the
  beginning of the procedure in the Declaration
  Section

Dim Num_1 as Integer
Dim Age as String
Dim Reg_DOB as Date
Implicit Variables – variables is not formally
declared
             - it is a result from other variable
declarations


Dim Total1 As Integer    'Explicit declaration
Dim Total2 As Integer    'Explicit declaration
Total3 = Total1 + Total2   'Implicit declaration
Scope of Variables
The term Scope refers to whether the
variable is available outside the procedure
in which it appears. The scope is
procedure-level or module-level.


A variable declared with Dim at the
beginning of a procedure is only available
in that procedure.
Public Statement
- variable can be used in several forms of the
   project

Private Statement
- variable can only be used in the form it is
  declared
  Module-level – variables declared in the
   declarations section of the module
- available only for the control in the form

  Procedure-level - variables is declared
   inside a procedure is called
- the original value will go back to its default
   value once it is called
Constant
– stores a value that does not change the
  value during the execution of the
  procedure

Types of Constants

Intrinsic Constants – defined by Visual Basic

vbTrue
vbBlack
User-Defined Constants – defined by
 programmers that write the code

Const Pi = 3.1416
Const Max_Num = 100

Object Browser - displays all the intrinsic
 constants that are related to the properties of
 the controls being created, including the
 procedures and modules define for the object
Operators
Mathematical and Text operators


Operator        Definition              Example               Result
  ^            Exponent (power of)        4^2                   16
   *               Multiply                5*4                  20
   /               Divide                20 / 4                  5
   +                Add                   3+4                    7
   -              Subtract                7–3                    4
 Mod         Remainder of division       20 Mod 6                2
               Integer division           20  6                3
  &           String concatenation     "Joan" & " " & "Smith" "Joan Smith"


Note that the order of operators is determined by the usual rules in programming.
When a statement includes multiple operations the order of operations is:
Parentheses ( ), ^, *, /, , Mod, +, -
Logical operators
Operator    Definition          Example             Result
   =        Equal to               9 = 11           False
   >       Greater than            11 > 9            True
   <        Less than               11 < 9          False
   >=      Greater or equal        15 >= 15          True
   <=      Less or equal             9 <= 15         True
   <>       Not equal                9 <> 9          False
  AND       Logical AND       (9 = 9) AND (7 = 6)    False
   OR        Logical OR        (9 = 9) OR (7 = 6)     True
Control Structures

If...Then...Else

If condition1 Then
    statements1
Else
    statements2
End If

If condition1 is True, then statements1 block is executed; Else,
condition1 is not True, therefore statements2 block gets
executed. The structure must be terminated with the End If
statement.

The Else clause is optional. In a simple comparison, statements1
get executed or not.

If condition1 Then
    statements1
End If
Select Case
Can be used as an alternative to the If...Then...Else structure, especially
when many comparisons are involved.

Select Case ShirtSize
   Case 1
      SizeName.Caption = "Small"
   Case 2
      SizeName.Caption = "Medium"
   Case 3
      SizeName.Caption = "Large"
   Case 4
      SizeName.Caption = "Extra Large"
   Case Else
      SizeName.Caption = "Unknown size"
End Select
Do...Loop

Used to execute a block of statements an unspecified number of times.

Do While condition
  statements
Loop

First, the condition is tested; if condition is True, then the statements are
executed. When it gets to the Loop it goes back to the Do and tests
condition again. If condition is False on the first pass, the statements are
never executed.
For...Next


When the number of iterations of the loop is known, it is better to
use the For...Next rather than the Do...Loop.

For counter = start To end
  statements
Next

1) The counter is set to the value of start.
2) Counter is checked to see if it is greater than end; if yes, control
passes to the statement after the Next; if not the statements are
executed.
3)At Next, counter is incremented and goes back to step 2).

More Related Content

What's hot

Vb6 ch.8-3 cci
Vb6 ch.8-3 cciVb6 ch.8-3 cci
Vb6 ch.8-3 cciFahim Khan
 
Visual Basic Programming
Visual Basic ProgrammingVisual Basic Programming
Visual Basic Programming
Osama Yaseen
 
Vb6 ch.6-3 cci
Vb6 ch.6-3 cciVb6 ch.6-3 cci
Vb6 ch.6-3 cciFahim Khan
 
Visual programming
Visual programmingVisual programming
Visual programming
Dr. C.V. Suresh Babu
 
Part 12 built in function vb.net
Part 12 built in function vb.netPart 12 built in function vb.net
Part 12 built in function vb.net
Girija Muscut
 
Visual basic
Visual basicVisual basic
Visual basic
Alisha Korpal
 
Subprogramms
SubprogrammsSubprogramms
Subprogramms
janapriyanaidu
 
Introduction to Visual Basic 6.0 Fundamentals
Introduction to Visual Basic 6.0 FundamentalsIntroduction to Visual Basic 6.0 Fundamentals
Introduction to Visual Basic 6.0 Fundamentals
Sanay Kumar
 
Lecture 01 2017
Lecture 01 2017Lecture 01 2017
Lecture 01 2017
Jesmin Akhter
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
Anjan Mahanta
 
Programing techniques
Programing techniquesPrograming techniques
Programing techniques
Prabhjit Singh
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)pbarasia
 
Basic of qbasic
Basic of qbasicBasic of qbasic
Basic of qbasic
RoshanMaharjan13
 
Modular programming
Modular programmingModular programming
Modular programming
bhuwanbist1
 
Prg 211 prg211
Prg 211 prg211Prg 211 prg211
Prg 211 prg211
GOODCourseHelp
 
Modular programming in qbasic
Modular programming in qbasicModular programming in qbasic
Modular programming in qbasic
Cavite National Science High School
 
4 coding from algorithms
4 coding from algorithms4 coding from algorithms
4 coding from algorithmshccit
 
Complete list of all sap abap keywords
Complete list of all sap abap keywordsComplete list of all sap abap keywords
Complete list of all sap abap keywordsPrakash Thirumoorthy
 
Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)Mark Vincent Cantero
 

What's hot (20)

Vb6 ch.8-3 cci
Vb6 ch.8-3 cciVb6 ch.8-3 cci
Vb6 ch.8-3 cci
 
Visual Basic Programming
Visual Basic ProgrammingVisual Basic Programming
Visual Basic Programming
 
Vb6 ch.6-3 cci
Vb6 ch.6-3 cciVb6 ch.6-3 cci
Vb6 ch.6-3 cci
 
Visual programming
Visual programmingVisual programming
Visual programming
 
Part 12 built in function vb.net
Part 12 built in function vb.netPart 12 built in function vb.net
Part 12 built in function vb.net
 
Visual basic
Visual basicVisual basic
Visual basic
 
Subprogramms
SubprogrammsSubprogramms
Subprogramms
 
Introduction to Visual Basic 6.0 Fundamentals
Introduction to Visual Basic 6.0 FundamentalsIntroduction to Visual Basic 6.0 Fundamentals
Introduction to Visual Basic 6.0 Fundamentals
 
Lecture 01 2017
Lecture 01 2017Lecture 01 2017
Lecture 01 2017
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
 
Programing techniques
Programing techniquesPrograming techniques
Programing techniques
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)
 
Basic of qbasic
Basic of qbasicBasic of qbasic
Basic of qbasic
 
Modular programming
Modular programmingModular programming
Modular programming
 
Prg 211 prg211
Prg 211 prg211Prg 211 prg211
Prg 211 prg211
 
Modular programming in qbasic
Modular programming in qbasicModular programming in qbasic
Modular programming in qbasic
 
4 coding from algorithms
4 coding from algorithms4 coding from algorithms
4 coding from algorithms
 
Complete list of all sap abap keywords
Complete list of all sap abap keywordsComplete list of all sap abap keywords
Complete list of all sap abap keywords
 
Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)
 

Viewers also liked

Visual basic para docentes
Visual basic para docentesVisual basic para docentes
Visual basic para docentesgabii2008
 
It presentation
It presentationIt presentation
It presentationmithu mehr
 
Stone portfolioscriptlance
Stone portfolioscriptlanceStone portfolioscriptlance
Stone portfolioscriptlance
Nancy Kotsifakis
 
Excel 2013
Excel 2013Excel 2013
Excel 2013
RShankar31
 
Excel 2013 Unit C
Excel 2013 Unit CExcel 2013 Unit C
Excel 2013 Unit Cjarana00
 
Sample Excel 2013 Advanced Essentials
Sample Excel 2013 Advanced EssentialsSample Excel 2013 Advanced Essentials
Sample Excel 2013 Advanced Essentials
learnbydoing
 
Access 2013 Unit D
Access 2013 Unit DAccess 2013 Unit D
Access 2013 Unit Djarana00
 
Access 2013
Access 2013 Access 2013
Access 2013
Carlos Menor
 
Access 2013 Unit A
Access 2013 Unit AAccess 2013 Unit A
Access 2013 Unit Ajarana00
 
SharePoint Summit 2013 - Vancouver - MS Access 2013 - The new (old) thing
SharePoint Summit 2013 - Vancouver - MS Access 2013 - The new (old) thingSharePoint Summit 2013 - Vancouver - MS Access 2013 - The new (old) thing
SharePoint Summit 2013 - Vancouver - MS Access 2013 - The new (old) thing
Ruven Gotz
 
Productivity programs excel assignment 1
Productivity programs excel assignment 1Productivity programs excel assignment 1
Productivity programs excel assignment 1
Beth Ann Cueni
 
PowerPoint 2013 -- What's New?
PowerPoint 2013 -- What's New?PowerPoint 2013 -- What's New?
PowerPoint 2013 -- What's New?
Indezine.com
 
Newspaper make up
Newspaper make upNewspaper make up
Newspaper make up
Deepali Meena
 
Shape Combine in PowerPoint
Shape Combine in PowerPoint Shape Combine in PowerPoint
Shape Combine in PowerPoint
Indezine.com
 
All ms word 2013
All ms word 2013All ms word 2013
All ms word 2013
Ashan Dissanayake
 
Power point 2013
Power point  2013Power point  2013
Power point 2013
Morelos Morelos
 
Ms word 2013
Ms word 2013Ms word 2013
Ms word 2013
mufassirin
 

Viewers also liked (20)

Visual basic para docentes
Visual basic para docentesVisual basic para docentes
Visual basic para docentes
 
It presentation
It presentationIt presentation
It presentation
 
Stone portfolioscriptlance
Stone portfolioscriptlanceStone portfolioscriptlance
Stone portfolioscriptlance
 
Excel 2013
Excel 2013Excel 2013
Excel 2013
 
Excel 2013 Unit C
Excel 2013 Unit CExcel 2013 Unit C
Excel 2013 Unit C
 
Sample Excel 2013 Advanced Essentials
Sample Excel 2013 Advanced EssentialsSample Excel 2013 Advanced Essentials
Sample Excel 2013 Advanced Essentials
 
Access 2013 Unit D
Access 2013 Unit DAccess 2013 Unit D
Access 2013 Unit D
 
Access 2013
Access 2013 Access 2013
Access 2013
 
Access 2013 Unit A
Access 2013 Unit AAccess 2013 Unit A
Access 2013 Unit A
 
SharePoint Summit 2013 - Vancouver - MS Access 2013 - The new (old) thing
SharePoint Summit 2013 - Vancouver - MS Access 2013 - The new (old) thingSharePoint Summit 2013 - Vancouver - MS Access 2013 - The new (old) thing
SharePoint Summit 2013 - Vancouver - MS Access 2013 - The new (old) thing
 
Productivity programs excel assignment 1
Productivity programs excel assignment 1Productivity programs excel assignment 1
Productivity programs excel assignment 1
 
PowerPoint 2013 -- What's New?
PowerPoint 2013 -- What's New?PowerPoint 2013 -- What's New?
PowerPoint 2013 -- What's New?
 
Power point 2013
Power point 2013Power point 2013
Power point 2013
 
Newspaper make up
Newspaper make upNewspaper make up
Newspaper make up
 
POWER POINT 2013
POWER POINT 2013 POWER POINT 2013
POWER POINT 2013
 
Shape Combine in PowerPoint
Shape Combine in PowerPoint Shape Combine in PowerPoint
Shape Combine in PowerPoint
 
Powerpoint 2013
Powerpoint 2013Powerpoint 2013
Powerpoint 2013
 
All ms word 2013
All ms word 2013All ms word 2013
All ms word 2013
 
Power point 2013
Power point  2013Power point  2013
Power point 2013
 
Ms word 2013
Ms word 2013Ms word 2013
Ms word 2013
 

Similar to Ms vb

Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
JOSEPHINEA6
 
01 Database Management (re-uploaded)
01 Database Management (re-uploaded)01 Database Management (re-uploaded)
01 Database Management (re-uploaded)
bluejayjunior
 
Ppt on visual basics
Ppt on visual basicsPpt on visual basics
Ppt on visual basics
younganand
 
COM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptxCOM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptx
AnasYunusa
 
Visualbasic tutorial
Visualbasic tutorialVisualbasic tutorial
Visualbasic tutorial
Andi Simanjuntak
 
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docxStudent Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docx
emelyvalg9
 
AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1
guest38bf
 
ArduinoWorkshop2.pdf
ArduinoWorkshop2.pdfArduinoWorkshop2.pdf
ArduinoWorkshop2.pdf
PedramKashiani
 
Visual basic
Visual basicVisual basic
Visual basic
pavishkumarsingh
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
DivyaKS12
 
Programming basics
Programming basicsProgramming basics
Programming basics
Senri DLN
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Visual Programming
Visual ProgrammingVisual Programming
Visual Programming
Bagzzz
 
I x scripting
I x scriptingI x scripting
I x scripting
Alex do Amaral Dias
 
Vb lecture
Vb lectureVb lecture
Vb lecture
alldesign
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
Heather Dionne
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
EliasPetros
 
Book management system
Book management systemBook management system
Book management system
SHARDA SHARAN
 

Similar to Ms vb (20)

Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
 
01 Database Management (re-uploaded)
01 Database Management (re-uploaded)01 Database Management (re-uploaded)
01 Database Management (re-uploaded)
 
Ppt on visual basics
Ppt on visual basicsPpt on visual basics
Ppt on visual basics
 
COM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptxCOM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptx
 
Introduction to Visual Basic
Introduction to Visual Basic Introduction to Visual Basic
Introduction to Visual Basic
 
Visualbasic tutorial
Visualbasic tutorialVisualbasic tutorial
Visualbasic tutorial
 
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docxStudent Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab 6.docx
 
AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1
 
ArduinoWorkshop2.pdf
ArduinoWorkshop2.pdfArduinoWorkshop2.pdf
ArduinoWorkshop2.pdf
 
Visual basic
Visual basicVisual basic
Visual basic
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
 
Programming basics
Programming basicsProgramming basics
Programming basics
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
 
Visual Programming
Visual ProgrammingVisual Programming
Visual Programming
 
I x scripting
I x scriptingI x scripting
I x scripting
 
Vb lecture
Vb lectureVb lecture
Vb lecture
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
 
Book management system
Book management systemBook management system
Book management system
 

Recently uploaded

CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 

Recently uploaded (20)

CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 

Ms vb

  • 2. A Brief History of Basic · Language developed in early 1960's at Dartmouth College: B (eginner's) A (All-Purpose) S (Symbolic) I (Instruction) C (Code) · Answer to complicated programming languages (FORTRAN, Algol, Cobol ...). First timeshare language.
  • 3. A Brief History of Basic . In the mid-1970's, two college students write first Basic for a microcomputer (Altair) - cost $350 on cassette tape. You may have heard of them: Bill Gates and Paul Allen! · Every Basic since then essentially based on that early version. Examples include: GW-Basic, QBasic, QuickBasic. · Visual Basic was introduced in 1991.
  • 4. Visual Basic versions Visual Basic 6.0 versus Other Versions of Visual Basic · The original Visual Basic for DOS and Visual Basic For Windows were introduced in 1991. · Visual Basic 3.0 (a vast improvement over previous versions) was released in 1993. · Visual Basic 4.0 released in late 1995 (added 32 bit application support). · ·
  • 5. Visual Basic versions Visual Basic 5.0 released in late 1996. New environment, supported creation of ActiveX controls, deleted 16 bit application support. · And, now Visual Basic 6.0 - some identified new features of Visual Basic 6.0: Þ Faster compiler Þ New ActiveX data control object Þ Allows database integration with wide variety of applications Þ New data report designer Þ New Package & Deployment Wizard Þ Additional internet capabilities
  • 6. What is Visual Basic ? • A high level programming language • Created by Microsoft • Uses a graphic environment called Integrated Development Environment (IDE) • Capable of developing Windows-based applications and games • Event –driven language • Made up of many subprograms , each with its own codes that can run independently, and at the same time can be linked together
  • 7. DEFINITION OF TERMS 1. Application - collection of objects that works together to accomplish a certain task/s for its users Examples: MS Word, Adobe Photoshop, Corel Draw 2. Project - the term used in Visual Basic pertaining to Application Examples: Payroll System, Quiz Bee Scoring Program
  • 8. DEFINITION OF TERMS 3. Object– a piece of software that has properties and functions that can be managed or controlled Examples: window, dialog box
  • 9. DEFINITION OF TERMS 4. Property – characteristic of an object Examples: color, size, background 5. Method – functions of an object that can be manipulated Examples: opening, resizing, moving (of a window)
  • 10. DEFINITION OF TERMS 6.Object-Oriented Environment – a place wherein application is created using objects and combining them to produce an output 7. Event – an action that happens Examples: clicking of a button, clicking of a menu, loading of form
  • 11. DEFINITION OF TERMS 8. Event- Driven – an operation is executed as the result of some kind of event 9. Form – the first object you will see on the screen when you open Visual Basic - it is where all the controls are placed - it is also where you will enter data and see the results 10. Controls –the object you put on a form Examples: text box, label, command
  • 12. DEFINITION OF TERMS 11. Code -computer instructions written by the programmer indicates what the action or result will be when an event occurs Examples: getting the total of 2 numbers once the button is clicked pop-up message appear 12.Script – other name for code 13. Design time - time when you visually design and layout the forms and object in it 14. Run Time - time when the program is executed
  • 13. Why is operation event –driven?
  • 14. The Main Window consists of the title bar, menu bar, and toolbar. Title bar indicates the project name, the current Visual Basic operating mode, and the current form. Menu bar has drop-down menus from which you control the operation of the Visual Basic environment.
  • 15.
  • 16.  Toolbar has buttons that provide shortcuts to some of the menu options.  The Main window also shows the location of the current form relative to the upper left corner of the screen (measured in twips) and the width and length of the current form.
  • 17. The Form Window is central to developing Visual Basic applications. It is where you draw your application.
  • 18. The Toolbox is the selection menu for controls used in your application.
  • 19. The Properties Window is used to establish initial property values for objects. The drop-down box at the top of the window lists all objects in the current form. Two views are available: Alphabetic and Categorized. Under this box are the available properties for the currently selected object.
  • 20.
  • 21. The Form Layout Window shows where (upon program execution) your form will be displayed relative to your monitor’s screen:
  • 22. The Project Window displays a list of all forms and modules making up your application. You can also obtain a view of the Form or Code windows (window containing the actual Basic coding) from the Project window.
  • 24.
  • 25.
  • 26.
  • 27. Take note: Properties Window Alignment = how text aligns in the control Back Color = choose the color of the background Caption = the text that will appear in the control Font = choose the font type and size Fore Color = choose the color of the text (foreground) Remember: Save the project as often as it should be.
  • 28.
  • 29.
  • 30. To switch between the Code window and the Form window, use the buttons just over the Project Explorer window (diagram on the left).
  • 31. Tips on Improving your application -write the simplest program that you understand and make it work - even if it doesn't have color or fancy fonts, test it and then save it; -make a copy of your previous working program and code one or two improvements in the copy - repeat for every improvement you make, using small steps so that if something does go wrong its easier to identify the source of the problem
  • 32. Avoid repeating code! The way to correct the application is to take all the code that repeats and put it into a separate procedure. A procedure is identified by the Private Sub ... End Sub lines. Call the procedure simply by writing its name.
  • 33. Writing code Code Editor Cut, Copy, Paste, Find, Replace
  • 34. GOOD HABITS: 1.Use comments 2.Use indents 3.Use standard capitalization 4.Write extra-long statements on 2 lines using the continuation character _ (space underscore)
  • 35.
  • 36.
  • 37.
  • 38. VARIABLES AND CONSTANT S
  • 39. Variables and Constants VARIABLE  are used by Visual Basic to hold information needed by your application  sign or a name that stands for a particular value in a program  may store a data while the program is running
  • 40. Naming Conventions These are the rules to follow when naming elements in VB - variables, constants, controls, procedures, and so on: A name must begin with a letter. May be as much as 255 characters
  • 41. Naming Conventions  Must not contain a space or an embedded period or type-declaration characters used to specify a data type ; these are ! # % $ & @  Must not be a reserved word (that is part of the code, like Option, for example).  The dash, although legal, should be avoided because it may be confused with the minus sign. Instead of Family-name use Familyname or FamilyName.
  • 42. Declaring Variables Explicit Declaration – variable is declared at the beginning of the procedure in the Declaration Section Dim Num_1 as Integer Dim Age as String Dim Reg_DOB as Date
  • 43. Implicit Variables – variables is not formally declared - it is a result from other variable declarations Dim Total1 As Integer 'Explicit declaration Dim Total2 As Integer 'Explicit declaration Total3 = Total1 + Total2 'Implicit declaration
  • 44. Scope of Variables The term Scope refers to whether the variable is available outside the procedure in which it appears. The scope is procedure-level or module-level. A variable declared with Dim at the beginning of a procedure is only available in that procedure.
  • 45. Public Statement - variable can be used in several forms of the project Private Statement - variable can only be used in the form it is declared
  • 46.
  • 47.  Module-level – variables declared in the declarations section of the module - available only for the control in the form  Procedure-level - variables is declared inside a procedure is called - the original value will go back to its default value once it is called
  • 48. Constant – stores a value that does not change the value during the execution of the procedure Types of Constants Intrinsic Constants – defined by Visual Basic vbTrue vbBlack
  • 49. User-Defined Constants – defined by programmers that write the code Const Pi = 3.1416 Const Max_Num = 100 Object Browser - displays all the intrinsic constants that are related to the properties of the controls being created, including the procedures and modules define for the object
  • 50.
  • 51.
  • 52.
  • 53.
  • 54. Operators Mathematical and Text operators Operator Definition Example Result ^ Exponent (power of) 4^2 16 * Multiply 5*4 20 / Divide 20 / 4 5 + Add 3+4 7 - Subtract 7–3 4 Mod Remainder of division 20 Mod 6 2 Integer division 20 6 3 & String concatenation "Joan" & " " & "Smith" "Joan Smith" Note that the order of operators is determined by the usual rules in programming. When a statement includes multiple operations the order of operations is: Parentheses ( ), ^, *, /, , Mod, +, -
  • 55. Logical operators Operator Definition Example Result = Equal to 9 = 11 False > Greater than 11 > 9 True < Less than 11 < 9 False >= Greater or equal 15 >= 15 True <= Less or equal 9 <= 15 True <> Not equal 9 <> 9 False AND Logical AND (9 = 9) AND (7 = 6) False OR Logical OR (9 = 9) OR (7 = 6) True
  • 56. Control Structures If...Then...Else If condition1 Then statements1 Else statements2 End If If condition1 is True, then statements1 block is executed; Else, condition1 is not True, therefore statements2 block gets executed. The structure must be terminated with the End If statement. The Else clause is optional. In a simple comparison, statements1 get executed or not. If condition1 Then statements1 End If
  • 57. Select Case Can be used as an alternative to the If...Then...Else structure, especially when many comparisons are involved. Select Case ShirtSize Case 1 SizeName.Caption = "Small" Case 2 SizeName.Caption = "Medium" Case 3 SizeName.Caption = "Large" Case 4 SizeName.Caption = "Extra Large" Case Else SizeName.Caption = "Unknown size" End Select
  • 58. Do...Loop Used to execute a block of statements an unspecified number of times. Do While condition statements Loop First, the condition is tested; if condition is True, then the statements are executed. When it gets to the Loop it goes back to the Do and tests condition again. If condition is False on the first pass, the statements are never executed.
  • 59. For...Next When the number of iterations of the loop is known, it is better to use the For...Next rather than the Do...Loop. For counter = start To end statements Next 1) The counter is set to the value of start. 2) Counter is checked to see if it is greater than end; if yes, control passes to the statement after the Next; if not the statements are executed. 3)At Next, counter is incremented and goes back to step 2).