SlideShare ist ein Scribd-Unternehmen logo
1 von 4
erwin_paramio@yahoo.com   Page 1 of
4
1.2 What is Visual Basic?


VISUAL BASIC is a high level programming language which evolved from the earlier DOS version called BASIC. BASIC means Beginners' All-purpose
Symbolic Instruction Code. It is a very easy programming language to learn. The code looks a lot like English Language. Different software
companies produced different versions of BASIC, such as Microsoft QBASIC, QUICKBASIC, GWBASIC , IBM BASICA and so on. However, people 6
                                                                                                     Lesson1 : Introduction to Visual Basic
prefer to use Microsoft Visual Basic today, as it is a well-developed programming language and supporting resources are available everywhere.
Now, there are many versions of VB exist in the market, the most popular one and still widely used by many VB programmers is none other than
Visual Basic 6. We also have VB.net, VB2005 and the latest VB2008, which is a fully object oriented programming (OOP) language. It is more
powerful than VB6 but looks more complicated to master.

VISUAL BASIC is a VISUAL and events driven Programming Language. These are the main divergence from the old BASIC. In BASIC, programming is
done in a text-only environment and the program is executed sequentially. In VB, programming is done in a graphical environment. In the old
BASIC, you have to write program code for each graphical object you wish to display it on screen, including its position and its color. However, In
VB , you just need to drag and drop any graphical object anywhere on the form, and you can change its color any time using the properties
windows.

On the other hand, because the user may click on certain object randomly, so each object has to be programmed independently to be able to
response to those actions (events). Therefore, a VB Program is made up of many subprograms, each has its own program code, and each can be
executed independently and at the same time each can be linked together in one way or another.

1.3 What programs can you create with Visual Basic 6?


With VB 6, you can create any program depending on your objective. For example, if you are a college or university lecturer, you can create
educational programs to teach business, economics, engineering, computer science, accountancy , financial management, information system and
more to make teaching more effective and interesting. If you are in business, you can also create business programs such as inventory
management system, point-of-sale system, payroll system, financial program as well as accounting program to help manage your business and
increase productivity. For those of you who like games and working as games programmer, you can create those programs as well. Indeed, there is
no limit to what program you can create! There are many such programs in this tutorial, so you must spend more time on the tutorial in order to
learn how to create those programs.

1.4 The Visual Basic 6 Integrated Development Environment


Before you can program in VB 6, you need to install Visual Basic 6 in your computer.
g
r
a
m
).
N
o
w
,
cl
ic
k
o
n
t
h
e
S
t
a
n
d                                                                                                   Lesson 2: Building Visual Basic Applications
a
r
d
E
X
E
ic
o
n
t
erwin_paramio@yahoo.com
o                                                                                                                                    Page 2 of
g
4
o
i
n
2.1 Creating Your First Application


 In this section, we will not go into the technical aspects of Visual Basic programming yet, what you need to do is just try out the examples below to
see how does in VB program look like:

Example 2.1.1 is a simple program. First of all, you have to launch Microsoft Visual Basic 6. Normally, a default form with the name Form1 will be
available for you to start your new project. Now, double click on Form1, the source code window for Form1 as shown in figure 2.1 will appear. The
top of the source code window consists of a list of objects and their associated events or procedures. In figure 2.1, the object displayed is Form and
                                                               the associated procedure is Load.

                                                               When you click on the object box, the drop-down list will display a list of objects you
                                                               have inserted into your form as shown in figure 2.2. Here, you can see a form with
                                                               the name Form1, a command button with the name Command1, a Label with the
                                                               name Label1 and a Picture Box with the name Picture1. Similarly, when you click on
                                                               the procedure box, a list of procedures associated with the object will be displayed as
                                                               shown in figure 2.3. Some of the procedures associated with the object Form1 are
                                                               Activate, Click, DblClick (which means Double-Click) , DragDrop, keyPress and more.
                                                               Each object has its own set of procedures. You can always select an object and write
                                                               codes for any of its procedure in order to perform certain tasks.

                                                               You do not have to worry about the beginning and the end statements (i.e. Private
          Figure 2.1 Source Code Window                        Sub Form_Load.......End Sub.); Just key in the lines in between the above two
                                                               statements exactly as are shown here. When you press F5 to run the program, you
                                                               will be surprise that nothing shown up .In order to display the output of the program,
                                                               you have to add the Form1.show statement like in Example 2.1.1 or you can just use
                                                               Form_Activate ( ) event procedure as shown in example 2.1.2. The command Print
                                                               does not mean printing using a printer but it means displaying the output on the
                                                               computer screen. Now, press F5 or click on the run button to run the program and
                                                               you will get the output as shown in figure 2.4.

                                                                You can also perform arithmetic calculations as shown in example 2.1.2. VB uses * to
                                                               denote the multiplication operator and / to denote the division operator. The output
                                                               is shown in figure 2.3, where the results are arranged vertically.
              Figure 2.2 Lists of Object

              Private Sub Form_Load ( )
                      Form1.show
                      Print “Welcome to Visual Basic tutorial”
              End Sub
                                Example 2.1.1


                      Private Sub Form_Activate ( )
                              Print 20 + 10
                              Print 20 - 10
                              Print 20 * 10
                              Print 20 / 10
                      End Sub
                               Example 2.1.2                                                         Figure 2.3: List oOf Procedures

You can also use the + or the & operator to join two or more texts (string) together like
in example 2.1.4 (a) and (b)


    Private Sub                                 Private Sub
            A = Tom                                     A = Tom
            B = “likes"                                 B = “likes"
            C = “to"                                    C = “to"
            D = “eat"                                   D = “eat"
            E = “burger"                                E = “burger"
            Print A + B + C + D + E                     Print A & B & C & D & E
    End Sub                                     End Sub
            Example 2.1.4 (a)                           Example 2.1.4 (b)
erwin_paramio@yahoo.com                                                                                                                 Page 3 of
4
                                                                                                Figure 2.4: The output of example 2.1.1
2.2 Steps in Building a Visual Basic Application


Step 1 : Design the interface
Step 2 : Set properties of the controls (Objects)
Step 3 : Write the event procedures




                                                    The Output of Example 2.1.4(a) &(b) is
                                                           as shown in Figure 2.7.




erwin_paramio@yahoo.com                                                             Page 4 of
4

Weitere ähnliche Inhalte

Was ist angesagt?

Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface DesignChapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Designfrancopw
 

Was ist angesagt? (7)

Getting Started
Getting StartedGetting Started
Getting Started
 
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface DesignChapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Design
 
Getting Started
Getting StartedGetting Started
Getting Started
 
Getting -2
Getting -2Getting -2
Getting -2
 
Getting Started
Getting StartedGetting Started
Getting Started
 
Getting Started
Getting StartedGetting Started
Getting Started
 
Getting Started
Getting StartedGetting Started
Getting Started
 

Andere mochten auch

Moving to Online Publications
Moving to Online PublicationsMoving to Online Publications
Moving to Online PublicationsColin McCaffrey
 
Books of Hours as Windows on the Medieval World
Books of Hours as Windows on the Medieval WorldBooks of Hours as Windows on the Medieval World
Books of Hours as Windows on the Medieval WorldColin McCaffrey
 

Andere mochten auch (6)

Social mediaslidedeck
Social mediaslidedeckSocial mediaslidedeck
Social mediaslidedeck
 
Moving to Online Publications
Moving to Online PublicationsMoving to Online Publications
Moving to Online Publications
 
Books of Hours as Windows on the Medieval World
Books of Hours as Windows on the Medieval WorldBooks of Hours as Windows on the Medieval World
Books of Hours as Windows on the Medieval World
 
#4 Elevator Pitch Santiago
#4 Elevator Pitch Santiago#4 Elevator Pitch Santiago
#4 Elevator Pitch Santiago
 
Sirby flyer 2015_ita
Sirby flyer 2015_itaSirby flyer 2015_ita
Sirby flyer 2015_ita
 
Calendario niveaplaza
Calendario niveaplazaCalendario niveaplaza
Calendario niveaplaza
 

Ähnlich wie Ps4 lesson 1

Vb tutorial
Vb tutorialVb tutorial
Vb tutorialjayguyab
 
Vbtutorial
VbtutorialVbtutorial
Vbtutorialdhi her
 
Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6Jeanie Arnoco
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lecturesmarwaeng
 
Devry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startedDevry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startednoahjamessss
 
Devry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startedDevry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startedgovendaagoovenda
 
Class viii ch-7 visual basic 2008
Class  viii ch-7 visual basic 2008Class  viii ch-7 visual basic 2008
Class viii ch-7 visual basic 2008jessandy
 
Visual basics Express Project
Visual basics Express ProjectVisual basics Express Project
Visual basics Express ProjectIftikhar Ahmed
 
Book HH- vb2008me preview
Book   HH- vb2008me previewBook   HH- vb2008me preview
Book HH- vb2008me previewSatya Harish
 
Cis 170 ilab 1 of 7
Cis 170 ilab 1 of 7Cis 170 ilab 1 of 7
Cis 170 ilab 1 of 7comp274
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxEliasPetros
 
Visual basic concepts
Visual basic conceptsVisual basic concepts
Visual basic conceptsmelody77776
 
CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   llflowe
 
CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   bellflower42
 

Ähnlich wie Ps4 lesson 1 (20)

Vb tutorial
Vb tutorialVb tutorial
Vb tutorial
 
Lab1
Lab1Lab1
Lab1
 
Vbtutorial
VbtutorialVbtutorial
Vbtutorial
 
Ch02 bronson
Ch02 bronsonCh02 bronson
Ch02 bronson
 
Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6
 
Vb 6ch123
Vb 6ch123Vb 6ch123
Vb 6ch123
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
 
Devry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startedDevry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-started
 
Devry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startedDevry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-started
 
Class viii ch-7 visual basic 2008
Class  viii ch-7 visual basic 2008Class  viii ch-7 visual basic 2008
Class viii ch-7 visual basic 2008
 
Visual basic
Visual basicVisual basic
Visual basic
 
Visual basics Express Project
Visual basics Express ProjectVisual basics Express Project
Visual basics Express Project
 
Vb.net and .Net Framework
Vb.net and .Net FrameworkVb.net and .Net Framework
Vb.net and .Net Framework
 
Book HH- vb2008me preview
Book   HH- vb2008me previewBook   HH- vb2008me preview
Book HH- vb2008me preview
 
Visual C# 2010
Visual C# 2010Visual C# 2010
Visual C# 2010
 
Cis 170 ilab 1 of 7
Cis 170 ilab 1 of 7Cis 170 ilab 1 of 7
Cis 170 ilab 1 of 7
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
 
Visual basic concepts
Visual basic conceptsVisual basic concepts
Visual basic concepts
 
CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   
 
CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   
 

Kürzlich hochgeladen

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
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.christianmathematics
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 

Kürzlich hochgeladen (20)

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
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.
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
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
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

Ps4 lesson 1

  • 2. 1.2 What is Visual Basic? VISUAL BASIC is a high level programming language which evolved from the earlier DOS version called BASIC. BASIC means Beginners' All-purpose Symbolic Instruction Code. It is a very easy programming language to learn. The code looks a lot like English Language. Different software companies produced different versions of BASIC, such as Microsoft QBASIC, QUICKBASIC, GWBASIC , IBM BASICA and so on. However, people 6 Lesson1 : Introduction to Visual Basic prefer to use Microsoft Visual Basic today, as it is a well-developed programming language and supporting resources are available everywhere. Now, there are many versions of VB exist in the market, the most popular one and still widely used by many VB programmers is none other than Visual Basic 6. We also have VB.net, VB2005 and the latest VB2008, which is a fully object oriented programming (OOP) language. It is more powerful than VB6 but looks more complicated to master. VISUAL BASIC is a VISUAL and events driven Programming Language. These are the main divergence from the old BASIC. In BASIC, programming is done in a text-only environment and the program is executed sequentially. In VB, programming is done in a graphical environment. In the old BASIC, you have to write program code for each graphical object you wish to display it on screen, including its position and its color. However, In VB , you just need to drag and drop any graphical object anywhere on the form, and you can change its color any time using the properties windows. On the other hand, because the user may click on certain object randomly, so each object has to be programmed independently to be able to response to those actions (events). Therefore, a VB Program is made up of many subprograms, each has its own program code, and each can be executed independently and at the same time each can be linked together in one way or another. 1.3 What programs can you create with Visual Basic 6? With VB 6, you can create any program depending on your objective. For example, if you are a college or university lecturer, you can create educational programs to teach business, economics, engineering, computer science, accountancy , financial management, information system and more to make teaching more effective and interesting. If you are in business, you can also create business programs such as inventory management system, point-of-sale system, payroll system, financial program as well as accounting program to help manage your business and increase productivity. For those of you who like games and working as games programmer, you can create those programs as well. Indeed, there is no limit to what program you can create! There are many such programs in this tutorial, so you must spend more time on the tutorial in order to learn how to create those programs. 1.4 The Visual Basic 6 Integrated Development Environment Before you can program in VB 6, you need to install Visual Basic 6 in your computer. g r a m ). N o w , cl ic k o n t h e S t a n d Lesson 2: Building Visual Basic Applications a r d E X E ic o n t erwin_paramio@yahoo.com o Page 2 of g 4 o i n
  • 3. 2.1 Creating Your First Application In this section, we will not go into the technical aspects of Visual Basic programming yet, what you need to do is just try out the examples below to see how does in VB program look like: Example 2.1.1 is a simple program. First of all, you have to launch Microsoft Visual Basic 6. Normally, a default form with the name Form1 will be available for you to start your new project. Now, double click on Form1, the source code window for Form1 as shown in figure 2.1 will appear. The top of the source code window consists of a list of objects and their associated events or procedures. In figure 2.1, the object displayed is Form and the associated procedure is Load. When you click on the object box, the drop-down list will display a list of objects you have inserted into your form as shown in figure 2.2. Here, you can see a form with the name Form1, a command button with the name Command1, a Label with the name Label1 and a Picture Box with the name Picture1. Similarly, when you click on the procedure box, a list of procedures associated with the object will be displayed as shown in figure 2.3. Some of the procedures associated with the object Form1 are Activate, Click, DblClick (which means Double-Click) , DragDrop, keyPress and more. Each object has its own set of procedures. You can always select an object and write codes for any of its procedure in order to perform certain tasks. You do not have to worry about the beginning and the end statements (i.e. Private Figure 2.1 Source Code Window Sub Form_Load.......End Sub.); Just key in the lines in between the above two statements exactly as are shown here. When you press F5 to run the program, you will be surprise that nothing shown up .In order to display the output of the program, you have to add the Form1.show statement like in Example 2.1.1 or you can just use Form_Activate ( ) event procedure as shown in example 2.1.2. The command Print does not mean printing using a printer but it means displaying the output on the computer screen. Now, press F5 or click on the run button to run the program and you will get the output as shown in figure 2.4. You can also perform arithmetic calculations as shown in example 2.1.2. VB uses * to denote the multiplication operator and / to denote the division operator. The output is shown in figure 2.3, where the results are arranged vertically. Figure 2.2 Lists of Object Private Sub Form_Load ( ) Form1.show Print “Welcome to Visual Basic tutorial” End Sub Example 2.1.1 Private Sub Form_Activate ( ) Print 20 + 10 Print 20 - 10 Print 20 * 10 Print 20 / 10 End Sub Example 2.1.2 Figure 2.3: List oOf Procedures You can also use the + or the & operator to join two or more texts (string) together like in example 2.1.4 (a) and (b) Private Sub Private Sub A = Tom A = Tom B = “likes" B = “likes" C = “to" C = “to" D = “eat" D = “eat" E = “burger" E = “burger" Print A + B + C + D + E Print A & B & C & D & E End Sub End Sub Example 2.1.4 (a) Example 2.1.4 (b) erwin_paramio@yahoo.com Page 3 of 4 Figure 2.4: The output of example 2.1.1
  • 4. 2.2 Steps in Building a Visual Basic Application Step 1 : Design the interface Step 2 : Set properties of the controls (Objects) Step 3 : Write the event procedures The Output of Example 2.1.4(a) &(b) is as shown in Figure 2.7. erwin_paramio@yahoo.com Page 4 of 4