SlideShare ist ein Scribd-Unternehmen logo
1 von 49
DEPARTMENT OF COMPUTER SCIENCE
SCHOOL OF SCIENCE AND TECHNOLOGY
FEDERAL POLYTECHNIC BALI
OO BASIC (VISUAL BASIC PROGRAMMING)
COURSE CODE: COM 211
CONCEPT OF PROGRAMMING
The following are some of the related terms that we need to recall:
Program
Programmer
Programming
Programming language
The Meaning of Program
• Program is a set of instructions that control the
behavior of a computer.
Example: A program to calculate the
average of three numbers.
A=3; B=7; C=5; SUM = A+B+C;
AVERAGE = SUM/3
A Programmer
• Programmer is a person who writes a set of
instruction codes that control the behavior of
a computer.
• Programmer is a person who writes computer
Program.
Meaning of Programming
• Programming is a process of creating a set of
instructions code that tell a computer how to
perform a task.
• Programming is an act or process of coding.
Programming language
• Programming language is the language use in
writing set of instruction codes.
• Programming language is the language use in
writing computer program.
Examples of Programming languages
Some of the popular Programming languages are:
 Python
 C
 C++
Java
Visual Basic
etc.
VISUAL BASIC
• VISUAL BASIC is a high-level programming
language used from the earlier DOS version
called BASIC.
• BASIC means Beginners' All-purpose Symbolic
Instruction Code.
Some Features of Visual Basic
• It is a fairly easy programming language to learn.
• The codes look a bit like English Language.
• Visual Basic is an event-driven programming.
• It uses ready-made objects to build user interfaces that
make up the application.
Systems Development Cycle
Most IT projects work in cycles, some of the cycles (stages) are:
Feasibility Study (System Analysis)
Design
Programming (Coding)
Implementation
Feasibility Study (System Analysis)
Systems Analysts draw up plans on how the
users would exactly like the system to work.
System Design
The architectural feature of the system or
program need to be layout by the Computer
architects who will design the input and output
to match the user requirements.
Programming (Coding)
The programmer will take the specifications
from the Systems Analyst and then convert the
plans into actual computer programs.
The Visual Basic environment
The Visual Basic environment is made up of
several windows.
The term windows
Windows is a GUI with easily recognized graphic
icons which can be selected using the mouse
and commands chosen from menus.
The Windows of Visual Basic
Some of the windows in Visual Basic
environment includes:
Tools Bar
Toolbox
Form Designer Window
Form Layout Window
Properties Window
Project Explorer window
The toolbar
The Visual Basic tool bar functions like the tool
bar in any other Microsoft application.
It provides shortcuts for many of the common
operating commands.
Steps to Add Tool to Toolbar
• Click View on Menu bar
• Click toolbars
• Tick ✅ on desire tool
The tool box
The tool box gives you access to the controls
that you use on a form.
Steps to Display Toolbox
• Click View on Menu bar
• Click toolbox or
• Press Ctrl + Alt + X on Keyboard
Controls
A control is an object that is used on forms to
display output or get input.
Some Examples of Controls are:
Button,
label or grid
Text area
Etc.
Form Designer Window
The form designer window is where you
design the forms that make up your user
interface.
The Form
Form is an object that make of an User interface
with a collection of controls.
Form is an object that act as a GUI window of an
Application.
Examples of Form
Biodata Form
Contact Form
Etc.
The form layout window
The form layout window Move the form in the
screen to set the position of your form when
your application is running.
Properties Window
The properties window lists all the properties a
control has and their value.
A form, and each control on it, has a set of
properties such as size, position and color.
The project explorer (Solution explorer)
window
A project is a collection of the forms and code that make up an application.
Each form in your application is represented by a file in the project explorer window.
Steps to Display Project Explorer
window on VB Environment
• Click View on Menu bar
• Click Project explorer
Starting Visual Basic
From the Windows Start menu,
 choose Programs,
 Microsoft Visual Studio ,
and then Microsoft Visual Basic 10.
Stopping Visual Basic
• Click File menu,
• Choose Exit
• The Microsoft Visual Studio ask you to save
changes in your project.
Creating Simple application
The steps to create new project are:
Click the New Project dialog box from toolbar
Or Chose New Project from the File menu
Select Windows form application
Type the project name in the Name text field
Click OK
Saving the application Files
Save the application so that you can use it later.
The Step to save new files are:
 Click on save button on tools bar or
Right click on file title then
select save form
Or Click save all button on tools bar
Or Click file ,then Click save form or save all.
Running the application
We can see the application in action by running
it .
The steps to run the application are:
Simply pressing F5 key.
Or
click on Debugging button on the standard
tool bar and Select start debugging from the
dialog items,
Stop Running the application
Simply clicking stop Debugging button from the
standard tool bar.
Creating Executable File
The steps to create Executable File are:
Click the New Project dialog box from toolbar
Or Chose New Project from the File menu
Click the dialog box of other project types fr
Select Setup and Deployment wizard.
 Type Application Name
Next steps then Click OK
VISUAL BASIC CHARACTER SETS
The Microsoft Visual basic character sets consist of the
following:
 Alphabet A/ a – Z/z (Both Upper and Lower Case)
 Numeric Digits 0 – 9
 Decimal point (.)
 Grouping Characters (eg. Comma, colons, Semicolons,
single and double apostrophe, parenthesis)
 Relational Operators (eg. =, <>,>,< etc)
 Arithmetic Operators (eg. +, -, /, =. etc)
 Blank character
Data Types
The Visual Basic language works with all kinds of
data.
When you write a program, you need to decide
which data type best fits your program's data
values.
Visual Basic data types
Type Stores Memory
Requirement
Range of Values
Integer Whole numbers 2 bytes -32,768 to 32,767
Long Whole numbers 4 bytes Approximately +/- 2.1E9
Single Decimal numbers 4 bytes -3.402823E38 to -1.401298E-45 for negative values
and 1.401298E-45 to
3.402823E38 for positive values
Double Decimal numbers (double-
precision floating-point)
8 bytes -1.79769313486232E308 to -
4.94065645841247E-324 for negative values and
4.94065645841247E-324 to 1.79769313486232E308
for positive values
Currency Numbers with up to
15 digits left of the
decimal and 4 digits right
of the decimal
8 bytes 922,337,203,685,477.5808 to
922,337,203,685,477.5807
String Text information 1 byte per character Up to 65,000 characters for fixed-length strings and up
to 2 billion characters for dynamic strings
Byte Whole numbers 1 byte 0 to 255
Boolean Logical values 2 bytes True or False
Date Date and time information 8 bytes Jan 1st 100 to December 31st 9999
EXAMPLES OF VISUAL BASIC DATA
TYPE
integer data type: 21 ,-9455 , 32766
long data type: 32768 ,-95445 ,492848559
single data type: 0.01 ,565.32 -192.3424 ,9543.5645 ,6.5440E-24
double data type: -5968.5765934211133 ,4.532112E+92
928374.344838273567899990
currency data type: 123.45 0.69 63456.75 -1924.57
string data type: "London Bridge" "1932 Sycamore Street“
"^%#@#$%3939$%^&^&"
Boolean data type: True , False
VARIABLE DECLARATION IN VISUAL
BASIC
Variable Declaration is a way of storing and
retrieving data in a variable.
Declaring Variables means to create and name a
variable.
Defining the variable
defining the variable in Visual Basic required
these two things:
The name of the variable
The data type of the variable
Example: Dim VarName AS DataType
Dim—short for dimension—is a Visual Basic
statement that you write in an application’s
Code window.
Variable naming rules
The naming rules are as follows:
Names can be as short as one character or as
long as 40 characters.
Names must begin with a letter of the alphabet
and can be in either uppercase or lowercase
letters.
After the initial letter, names can contain letters,
numbers, or underscores in names.
Names cannot be a reserved word.
Never define two variables with the same name
EXAMPLES OF VARIABLE DECLARATION
Always use a Dim statement to define variables
before you use variables.
Dim ProductTotal As Currency
Dim Length As Integer
Dim Price As Single
Dim Structure As Double
Dim FirstName As String
Dim Title As String * 20
Assigning Values to Variables
Here is the (syntax) format of the assignment
statement:
VariableName = Expression
MinAge = 18
TodayTemp = 42.1
Dim Sales As Single, NewSales As Single
Sales = 3945.42
NewSales = Sales
Finaly NewSales have the value 3945.42
Assigning String to Caption of Control
This is the first of several program code reviews
that you will find throughout the course.
Sub cmdJoke_Click ()
cmdJoke.Caption = “Hello World"
End Sub
The primary math operators
Operator Example Description
+ Net + Disc Adds two values
- Price - 4.00 Subtracts one value from another value
* Total * Fact Multiplies two values
/ Tax / Adjust Divides one value by another value
^ Adjust ^ 3 Raises a value to a power
& or + Name1 &
Name2
Concatenates two strings
An operator is a word or symbol that does math and
data manipulation
Concatenation Operator
Definition: Concatenation means the joining
together of two or more strings.
• One of Visual Basic's primary operators has
nothing to do with math.
• The concatenation operator joins one string to
the end of another.
Example:
FullName = lblFirst & lblLast
Mathematical Expressions
We can calculate and assign expression results to
variables;
Examples
NetSales = AnnualSales – CostOfSales
Years = 4
Value = 10 ^ Years
Result = 3 + 5 * 2
FullName = lblFirst & lblLast
Conditional Operators
` Meaning Example
NOT Logical opposite
of condition
NOT True = False
NOT False = True
AND Both conditions
must apply (
True)
True AND True = True True
AND False = False False
AND True = False
OR Either condition
can apply (True)
True OR True = True True
OR False = True
False OR True = True False
OR False = False
CONTROLS
The following are some of the controls of VB:
 The Form
 Intrinsic Controls
 Focus In on Controls
 etc

Weitere ähnliche Inhalte

Ähnlich wie COM 211 PRESENTATION.pptx

hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
EliasPetros
 
Chapter 5( programming) answer
Chapter 5( programming) answerChapter 5( programming) answer
Chapter 5( programming) answer
smkengkilili2011
 
Program logic and design
Program logic and designProgram logic and design
Program logic and design
Chaffey College
 

Ähnlich wie COM 211 PRESENTATION.pptx (20)

Ch01
Ch01Ch01
Ch01
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
 
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
 
UNIT I.pptx
UNIT I.pptxUNIT I.pptx
UNIT I.pptx
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
 
Chapter 5( programming) answer
Chapter 5( programming) answerChapter 5( programming) answer
Chapter 5( programming) answer
 
Visual studio.net
Visual studio.netVisual studio.net
Visual studio.net
 
Getting started with test complete 7
Getting started with test complete 7Getting started with test complete 7
Getting started with test complete 7
 
Chapter 01
Chapter 01Chapter 01
Chapter 01
 
Program logic and design
Program logic and designProgram logic and design
Program logic and design
 
Leave management ppt made by krishna ballabh gupta
Leave management ppt made by krishna ballabh gupta Leave management ppt made by krishna ballabh gupta
Leave management ppt made by krishna ballabh gupta
 
Chapter 2- Prog101.ppt
Chapter 2- Prog101.pptChapter 2- Prog101.ppt
Chapter 2- Prog101.ppt
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
 
10tait
10tait10tait
10tait
 
Chapter 10
Chapter 10 Chapter 10
Chapter 10
 
Neha
NehaNeha
Neha
 
Visual Logic Project - 1
Visual Logic Project - 1Visual Logic Project - 1
Visual Logic Project - 1
 

Kürzlich hochgeladen

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
anilsa9823
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Kürzlich hochgeladen (20)

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 

COM 211 PRESENTATION.pptx

  • 1. DEPARTMENT OF COMPUTER SCIENCE SCHOOL OF SCIENCE AND TECHNOLOGY FEDERAL POLYTECHNIC BALI OO BASIC (VISUAL BASIC PROGRAMMING) COURSE CODE: COM 211
  • 2. CONCEPT OF PROGRAMMING The following are some of the related terms that we need to recall: Program Programmer Programming Programming language
  • 3. The Meaning of Program • Program is a set of instructions that control the behavior of a computer. Example: A program to calculate the average of three numbers. A=3; B=7; C=5; SUM = A+B+C; AVERAGE = SUM/3
  • 4. A Programmer • Programmer is a person who writes a set of instruction codes that control the behavior of a computer. • Programmer is a person who writes computer Program.
  • 5. Meaning of Programming • Programming is a process of creating a set of instructions code that tell a computer how to perform a task. • Programming is an act or process of coding.
  • 6. Programming language • Programming language is the language use in writing set of instruction codes. • Programming language is the language use in writing computer program.
  • 7. Examples of Programming languages Some of the popular Programming languages are:  Python  C  C++ Java Visual Basic etc.
  • 8. VISUAL BASIC • VISUAL BASIC is a high-level programming language used from the earlier DOS version called BASIC. • BASIC means Beginners' All-purpose Symbolic Instruction Code.
  • 9. Some Features of Visual Basic • It is a fairly easy programming language to learn. • The codes look a bit like English Language. • Visual Basic is an event-driven programming. • It uses ready-made objects to build user interfaces that make up the application.
  • 10. Systems Development Cycle Most IT projects work in cycles, some of the cycles (stages) are: Feasibility Study (System Analysis) Design Programming (Coding) Implementation
  • 11. Feasibility Study (System Analysis) Systems Analysts draw up plans on how the users would exactly like the system to work.
  • 12. System Design The architectural feature of the system or program need to be layout by the Computer architects who will design the input and output to match the user requirements.
  • 13. Programming (Coding) The programmer will take the specifications from the Systems Analyst and then convert the plans into actual computer programs.
  • 14. The Visual Basic environment The Visual Basic environment is made up of several windows.
  • 15. The term windows Windows is a GUI with easily recognized graphic icons which can be selected using the mouse and commands chosen from menus.
  • 16. The Windows of Visual Basic Some of the windows in Visual Basic environment includes: Tools Bar Toolbox Form Designer Window Form Layout Window Properties Window Project Explorer window
  • 17. The toolbar The Visual Basic tool bar functions like the tool bar in any other Microsoft application. It provides shortcuts for many of the common operating commands.
  • 18. Steps to Add Tool to Toolbar • Click View on Menu bar • Click toolbars • Tick ✅ on desire tool
  • 19. The tool box The tool box gives you access to the controls that you use on a form.
  • 20. Steps to Display Toolbox • Click View on Menu bar • Click toolbox or • Press Ctrl + Alt + X on Keyboard
  • 21. Controls A control is an object that is used on forms to display output or get input. Some Examples of Controls are: Button, label or grid Text area Etc.
  • 22. Form Designer Window The form designer window is where you design the forms that make up your user interface.
  • 23. The Form Form is an object that make of an User interface with a collection of controls. Form is an object that act as a GUI window of an Application. Examples of Form Biodata Form Contact Form Etc.
  • 24. The form layout window The form layout window Move the form in the screen to set the position of your form when your application is running.
  • 25. Properties Window The properties window lists all the properties a control has and their value. A form, and each control on it, has a set of properties such as size, position and color.
  • 26. The project explorer (Solution explorer) window A project is a collection of the forms and code that make up an application. Each form in your application is represented by a file in the project explorer window.
  • 27. Steps to Display Project Explorer window on VB Environment • Click View on Menu bar • Click Project explorer
  • 28. Starting Visual Basic From the Windows Start menu,  choose Programs,  Microsoft Visual Studio , and then Microsoft Visual Basic 10.
  • 29. Stopping Visual Basic • Click File menu, • Choose Exit • The Microsoft Visual Studio ask you to save changes in your project.
  • 30. Creating Simple application The steps to create new project are: Click the New Project dialog box from toolbar Or Chose New Project from the File menu Select Windows form application Type the project name in the Name text field Click OK
  • 31. Saving the application Files Save the application so that you can use it later. The Step to save new files are:  Click on save button on tools bar or Right click on file title then select save form Or Click save all button on tools bar Or Click file ,then Click save form or save all.
  • 32. Running the application We can see the application in action by running it . The steps to run the application are: Simply pressing F5 key. Or click on Debugging button on the standard tool bar and Select start debugging from the dialog items,
  • 33. Stop Running the application Simply clicking stop Debugging button from the standard tool bar.
  • 34. Creating Executable File The steps to create Executable File are: Click the New Project dialog box from toolbar Or Chose New Project from the File menu Click the dialog box of other project types fr Select Setup and Deployment wizard.  Type Application Name Next steps then Click OK
  • 35. VISUAL BASIC CHARACTER SETS The Microsoft Visual basic character sets consist of the following:  Alphabet A/ a – Z/z (Both Upper and Lower Case)  Numeric Digits 0 – 9  Decimal point (.)  Grouping Characters (eg. Comma, colons, Semicolons, single and double apostrophe, parenthesis)  Relational Operators (eg. =, <>,>,< etc)  Arithmetic Operators (eg. +, -, /, =. etc)  Blank character
  • 36. Data Types The Visual Basic language works with all kinds of data. When you write a program, you need to decide which data type best fits your program's data values.
  • 37. Visual Basic data types Type Stores Memory Requirement Range of Values Integer Whole numbers 2 bytes -32,768 to 32,767 Long Whole numbers 4 bytes Approximately +/- 2.1E9 Single Decimal numbers 4 bytes -3.402823E38 to -1.401298E-45 for negative values and 1.401298E-45 to 3.402823E38 for positive values Double Decimal numbers (double- precision floating-point) 8 bytes -1.79769313486232E308 to - 4.94065645841247E-324 for negative values and 4.94065645841247E-324 to 1.79769313486232E308 for positive values Currency Numbers with up to 15 digits left of the decimal and 4 digits right of the decimal 8 bytes 922,337,203,685,477.5808 to 922,337,203,685,477.5807 String Text information 1 byte per character Up to 65,000 characters for fixed-length strings and up to 2 billion characters for dynamic strings Byte Whole numbers 1 byte 0 to 255 Boolean Logical values 2 bytes True or False Date Date and time information 8 bytes Jan 1st 100 to December 31st 9999
  • 38. EXAMPLES OF VISUAL BASIC DATA TYPE integer data type: 21 ,-9455 , 32766 long data type: 32768 ,-95445 ,492848559 single data type: 0.01 ,565.32 -192.3424 ,9543.5645 ,6.5440E-24 double data type: -5968.5765934211133 ,4.532112E+92 928374.344838273567899990 currency data type: 123.45 0.69 63456.75 -1924.57 string data type: "London Bridge" "1932 Sycamore Street“ "^%#@#$%3939$%^&^&" Boolean data type: True , False
  • 39. VARIABLE DECLARATION IN VISUAL BASIC Variable Declaration is a way of storing and retrieving data in a variable. Declaring Variables means to create and name a variable.
  • 40. Defining the variable defining the variable in Visual Basic required these two things: The name of the variable The data type of the variable Example: Dim VarName AS DataType Dim—short for dimension—is a Visual Basic statement that you write in an application’s Code window.
  • 41. Variable naming rules The naming rules are as follows: Names can be as short as one character or as long as 40 characters. Names must begin with a letter of the alphabet and can be in either uppercase or lowercase letters. After the initial letter, names can contain letters, numbers, or underscores in names. Names cannot be a reserved word. Never define two variables with the same name
  • 42. EXAMPLES OF VARIABLE DECLARATION Always use a Dim statement to define variables before you use variables. Dim ProductTotal As Currency Dim Length As Integer Dim Price As Single Dim Structure As Double Dim FirstName As String Dim Title As String * 20
  • 43. Assigning Values to Variables Here is the (syntax) format of the assignment statement: VariableName = Expression MinAge = 18 TodayTemp = 42.1 Dim Sales As Single, NewSales As Single Sales = 3945.42 NewSales = Sales Finaly NewSales have the value 3945.42
  • 44. Assigning String to Caption of Control This is the first of several program code reviews that you will find throughout the course. Sub cmdJoke_Click () cmdJoke.Caption = “Hello World" End Sub
  • 45. The primary math operators Operator Example Description + Net + Disc Adds two values - Price - 4.00 Subtracts one value from another value * Total * Fact Multiplies two values / Tax / Adjust Divides one value by another value ^ Adjust ^ 3 Raises a value to a power & or + Name1 & Name2 Concatenates two strings An operator is a word or symbol that does math and data manipulation
  • 46. Concatenation Operator Definition: Concatenation means the joining together of two or more strings. • One of Visual Basic's primary operators has nothing to do with math. • The concatenation operator joins one string to the end of another. Example: FullName = lblFirst & lblLast
  • 47. Mathematical Expressions We can calculate and assign expression results to variables; Examples NetSales = AnnualSales – CostOfSales Years = 4 Value = 10 ^ Years Result = 3 + 5 * 2 FullName = lblFirst & lblLast
  • 48. Conditional Operators ` Meaning Example NOT Logical opposite of condition NOT True = False NOT False = True AND Both conditions must apply ( True) True AND True = True True AND False = False False AND True = False OR Either condition can apply (True) True OR True = True True OR False = True False OR True = True False OR False = False
  • 49. CONTROLS The following are some of the controls of VB:  The Form  Intrinsic Controls  Focus In on Controls  etc