SlideShare ist ein Scribd-Unternehmen logo
1 von 36
• Basics of Visual Basic 6 Programming
• Design and develop Information Systems with the help of Visual
Basic as front-end.
Visual Basic 6
What is Visual Basic?
 It is an “Event Driven Programming Language”
 The "Visual" part refers to the method used to create the graphical user
interface (GUI). Rather than writing numerous lines of code to describe
the appearance and location of interface elements, you simply add
prebuilt objects into place on screen.
 The "Basic" part refers to the BASIC (Beginners All-Purpose Symbolic
Instruction Code) Visual Basic has evolved from the original BASIC
language and now contains several hundred statements, functions, and
keywords, many of which relate directly to the Windows GUI.
Beginners can create useful applications by learning just a few of the
keywords, yet the power of the language allows professionals to
accomplish anything that can be accomplished using any other
Windows programming language
Why Visual Basic??
 Data access features allow you to create databases, front-end
applications, and scalable server-side components for most popular
database formats, including Microsoft SQL Server and other enterprise-
level databases.
 ActiveX™ technologies allow you to use the functionality provided by
other applications, such as Microsoft Word word processor, Microsoft
Excel spreadsheet, and other Windows applications. You can even
automate applications and objects created using Visual Basic.
 Internet capabilities make it easy to provide access to documents and
applications across the Internet or intranet from within your
application, or to create Internet server applications.
 Your finished application is a true .exe file that uses a Visual Basic
Virtual Machine that you can freely distribute.
Interpreting and Compiling
 The traditional application development process :
 writing
 compiling
 testing code
 Visual Basic uses an interactive approach to development, blurring the
distinction between the three steps.
 Visual Basic interprets your code as you enter it, catching and highlighting
most syntax or spelling errors on the fly. It's almost like having an expert
watching over your shoulder as you enter your code.
 In addition to catching errors on the fly, Visual Basic also partially compiles the
code as it is entered. When you are ready to run and test your application,
there is only a brief delay to finish compiling.
 Compilation also possible to generate faster applications
Key Concepts
 windows, events and messages.
 Think of a window as simply a rectangular region with its own boundaries.
 Explorer window
 document window within your word processing program,
 dialog box ,Icons, text boxes, option buttons and menu bars are all windows
OS manages all of these many windows by assigning each one a unique id
number (window handle or hWnd). The system continually monitors each of
these windows for signs of activity or events. Events can occur through user
actions such as a mouse click or a key press, through programmatic control, or
even as a result of another window's actions.
 Each time an event occurs, it causes a message to be sent to the operating
system. The system processes the message and broadcasts it to the other
windows. Each window can then take the appropriate action based on its own
instructions for dealing with that particular message (for example, repainting
itself when it has been uncovered by another window).
 Visual Basic insulates you from having to deal with all of the low-level
message handling.
Event Driven Programming
 In traditional or "procedural" applications, the application itself
controls which portions of code execute and in what sequence.
Execution starts with the first line of code and follows a predefined
path through the application, calling procedures as needed.
 In an event-driven application, the code doesn't follow a
predetermined path — it executes different code sections in response to
events. Events can be triggered by the user's actions, by messages from
the system or other applications, or even from the application itself.
The sequence of these events determines the sequence in which the
code executes, thus the path through the application's code differs each
time the program runs.
DEMO
Visual Basic Environment
Menu Bar
Toolbar
Form
Toolbox
Form Designer
Project
Explorer
Properties
Window
Form Layout
Window
Controls
Label
Text Box
Command Button
Check Box
Option Button
Frame
Combo
Box
List
Box
Control Properties
The most common and important
object properties are :-
 Name
 Caption
 Left
 Top
 Height
 Width
 Enabled
 Visible
Forms
Design Grid
Control BoxCaption
Icon
Labels
Frame
Text Boxes
Minimize
Maximize
Close
The Visual Basic Editor
DEMO
D A T A T Y P E S A N D V A R I A B L E S
W R I T I N G S T A T E M E N T S
M A T H O P E R A T I O N S
C O N T R O L S T A T E M E N T S
F U N C T I O N S
Language Basics
Data Types
 A Data Type is a set of values ,together with a set of
operations on those values having certain properties.
 Built in Type
 User Defined Types
Built in Type
Type Stores Memory(byte) Range
Integer Whole Number 2 -32,768 to +32,767
Long Whole Number 4 +/- 2 billions
Single Decimal 4 +/- 1E45 to 3E-38
Double Decimal 8 +/- 5E324 to 1.8E308
Currency 8 +/- 9E14
String Text 1/char <= 65400 char
Byte Whole Number 1 0-255
Boolean Logical 2 True/False
Date Date & Time 8 1/1/100 to 12/31/9999
Object Instance of
Classes
4 N/A
Variant Any of above 16 + 1/char N/A
Variables
 Variables are used to store information in
Computer’s memory while programs are running.
Three Components that define a variable:
 The Variable’s Name
 The Type of information being stored
 The actual information itself
Naming Variable
 Rules:
 The name must be start with a letter not number or other character.
 The remainder of name can contain numbers, letters and/or
underscore character. Space ,Punctuation are not allowed.
 Name should be unique within variable scope.
 The name can be no longer than 255 character.
 No reserve words.
Syntax: (Explicit Declaration)
Dim Var_name As Datatype
Example: Dim X As Integer
Syntax: (Implicit Declaration)
Dim Var_name
Constants
 Constants are values which remains unchanged.
Ex.
Const MeterToFeet = 3.3
User Defined Types
 In addition to Built in Types we can also create User
Defined Data Types as follows :-
 Ex.
Private Type Point
x As Integer
y As Integer
End Type
USES:
Private Sub Command1_Click()
Dim MyPoint As Point
MyPoint.x = 3
MyPoint.y = 5
End Sub
Writing Statements
Statement Type Example
Assign a value to a variable sName= “Ankit”
Call a Predefined Function MsgBox (“Good Morning”)
Call your own function A=fun(“hello”)
Assign Object Property Command1.visible = True
Make decisions If height > 1000 then MoveOn
Using Assignment Statements
 Assignments statements are used to assign values to
a variable.
Assignment Statements Type of Expression
S1 = 25 Numeric Literal
Str1 = “John” String literal
AvgScore = TotScore / n Mathematical Expression
Sname = “Mrs. “ & “ Tina” String Expression
Cname = Ucases$(“ Chris”) Return value of function
Math Operations
Operation Operator Uses
Addition + Res=num1+ num2
Subtraction - Res=num1-num2
Multiplication * Res=num1*num2
Division / Res=num1/num2
Integer division  Res=num1 num2
Modulus mod Res=num1 mod num2
Exponent ^ Res=num1+^num2
Strings
 Strings can be defined as array of characters.
 Strings Functions
 Ucase and Lcase
 InStr and InStrRev
 Left and Right
 Mid
 Ltrim, Rtrim and Trim
 Len
 Chr and Asc
 Str ,CStr and Val
 StrReverse
Examples
1. string1 = “himansu” & “ shekhar”
output : himansu shekhar
2. Ucase(“Hello”)
output: HELLO
3. Lcase(“HeLLo”)
Output: hello
4. Pos = InStr(“hi”, “sahoo himansu”) //return 6
5. Pos = InStrRev(“a”, “Nauman”) //return 5
6. Left(“Hello”, 3) //Hel
7. Right(“Hello”,2) //lo
8. Ltrim(“ Hello”) //Hello
9. Trim(“ Hello “) //Hello
10. Len(“Himansu”) //return 7
11. Chr(65) , Asc(‘A’) //return A, 65
12. Str(num), Val(string1)
13. StrReverse(“Hello”) //olleH
Decision Making
 Using If Statements:
Syntax:
If <condition> Then command
Example:
If cSal > cMaxSale Then msgbox(“Greater”)
Syntax:
If condition Then
………
Else
………
End If
Example:
If Deposit > 0 Then
total = total + Deposit
End If
Decision Making
 Using Multiple If Statements:
Syntax:
If condition Then
………
ElseIf condition Then
………
Else
………..
End If
Example:
If Bsal > 12000 Then
tSal = 2.5 * Bsal
ElseIf Bsal > 10000 Then
tSal = 2* Bsal
Else
tSal = 1.8 * Bsal
End If
Decision Making
 Select Case Examples
Syntax:
avgNum = total / n
Select Case Round(avgNum)
Case 100
grade = “EX”
Case 80 To 99
grade = “A”
………
End Select
Control Statements
 For Loop
Ex:
sum = 0
For i = 1 To 10
sum = sum + i
Next i
 Do While/Until Loop
Ex:
sum = 0
i = 1
Do
sum = sum + i
i = i + 1
Loop While/Until i <= 10
Control Statements
 While Loop
Ex:
sum = 0
i = 1
while i > 10
sum = sum + i
i = i + 1
wend
Functions
 Built in Functions
 User Defined Functions
 Sub Procedures
Built in Functions
 These are the functions that are the provided with
the Visual Basic Package. Some Examples are:
 Abs(num)
 Left(string, n)
 Val(Text1.Text)
 Combo1.AddItem
 Combo1.Clear
 Date
User Defined Functions
 Visual Basic allows to create user defined functions.
 User defined functions that are created by the users for
specific operations.
Ex 1:
Public Function Fun()
msgBox(“Hello”)
End Function
Ex 2:
Public Function AddNum(num1 As Integer, num2 As Integer) As Integer
AddNum = num1 + num2
End Function
Procedures
 Procedures can be defined in either of two ways.
 Public procedures
 Private procedure
 These two keywords ( Public and Private )
determines which other programs or procedures
have access to your procedures.
 Procedures are by default Private.
Procedure
 Examples:
Sub CalRect(nWidth As Integer, nHeight As Integer, nArea As Integer,
nPerimeter As
Integer)
If nWidth <= 0 Or nHeight <= 0 Then
Exit Sub
End If
nArea = nWidth * nHeight
nPerimeter = 2 * ( nWidth + nHeight )
End Sub
Visual Basic forms and controls are objects which expose their own properties,
methods and
events. Properties can be thought of as an object's attributes, methods as its actions,
and events as its responses.
The common events related to several controls are as follows:-
 Change – The user modifies the text in a text box or combo box.
 Click- The user clicks an object with the primary mouse button( usually the left
button).
 Dblclick- The user double-clicks an object with the primary mouse button.
 DragDrop- The user drags a control to another location.
 DragOver- An object is dragged over a control.
 GotFocus – An object receives a focus.
 KeyDown- A key is pressed while an object has the focus.
 KeyPress- A key is pressed and released while an object has the focus.
 KeyUp- A key is released while an object has the focus.
 MouseDown- A mouse button is pressed while the mouse pointer is over an object.
 MouseMove- A mouse cursor is moved over an object.
 MouseUp- A mouse button is released while the mouse pointer is over an object.
Events

Weitere ähnliche Inhalte

Was ist angesagt?

Visual Programming
Visual ProgrammingVisual Programming
Visual ProgrammingBagzzz
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programmingRoger Argarin
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.netJaya Kumari
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introductionbloodyedge03
 
Common dialog control
Common dialog controlCommon dialog control
Common dialog controlSoumya Vijoy
 
Event handling
Event handlingEvent handling
Event handlingswapnac12
 
Asp.NET Validation controls
Asp.NET Validation controlsAsp.NET Validation controls
Asp.NET Validation controlsGuddu gupta
 
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
 
ASP.NET 10 - Data Controls
ASP.NET 10 - Data ControlsASP.NET 10 - Data Controls
ASP.NET 10 - Data ControlsRandy Connolly
 

Was ist angesagt? (20)

Vb basics
Vb basicsVb basics
Vb basics
 
Visual Programming
Visual ProgrammingVisual Programming
Visual Programming
 
Vb.net ide
Vb.net ideVb.net ide
Vb.net ide
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
 
Meaning Of VB
Meaning Of VBMeaning Of VB
Meaning Of VB
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.net
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Visual basic
Visual basicVisual basic
Visual basic
 
4. listbox
4. listbox4. listbox
4. listbox
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introduction
 
Applet
 Applet Applet
Applet
 
Common dialog control
Common dialog controlCommon dialog control
Common dialog control
 
Controls
ControlsControls
Controls
 
Event handling
Event handlingEvent handling
Event handling
 
Asp.NET Validation controls
Asp.NET Validation controlsAsp.NET Validation controls
Asp.NET Validation controls
 
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
 
ASP.NET 10 - Data Controls
ASP.NET 10 - Data ControlsASP.NET 10 - Data Controls
ASP.NET 10 - Data Controls
 

Andere mochten auch

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
 
Determining Requirements In System Analysis And Dsign
Determining Requirements In System Analysis And DsignDetermining Requirements In System Analysis And Dsign
Determining Requirements In System Analysis And DsignAsaduzzaman Kanok
 
Visual basics Express Project
Visual basics Express ProjectVisual basics Express Project
Visual basics Express ProjectIftikhar Ahmed
 
Specification of a Visual Programming Language by Example
Specification of a Visual Programming Language by ExampleSpecification of a Visual Programming Language by Example
Specification of a Visual Programming Language by ExampleMaximilian Fellner
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo cHanielle Cheng
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0Indah Sari
 
Visual Basic menu
Visual Basic menuVisual Basic menu
Visual Basic menukuldeep94
 
Variable, constant, operators and control statement
Variable, constant, operators and control statementVariable, constant, operators and control statement
Variable, constant, operators and control statementEyelean xilef
 
visual basic 6.0
visual basic 6.0visual basic 6.0
visual basic 6.0lesly53
 
Vb decision making statements
Vb decision making statementsVb decision making statements
Vb decision making statementspragya ratan
 

Andere mochten auch (20)

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)
 
5 Things
5 Things5 Things
5 Things
 
Determining Requirements In System Analysis And Dsign
Determining Requirements In System Analysis And DsignDetermining Requirements In System Analysis And Dsign
Determining Requirements In System Analysis And Dsign
 
Visual basics Express Project
Visual basics Express ProjectVisual basics Express Project
Visual basics Express Project
 
Specification of a Visual Programming Language by Example
Specification of a Visual Programming Language by ExampleSpecification of a Visual Programming Language by Example
Specification of a Visual Programming Language by Example
 
Visual basic 6
Visual basic 6Visual basic 6
Visual basic 6
 
Introduction to turbo c
Introduction to turbo cIntroduction to turbo c
Introduction to turbo c
 
Visual programming
Visual programmingVisual programming
Visual programming
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
 
Visual Basic menu
Visual Basic menuVisual Basic menu
Visual Basic menu
 
Variable, constant, operators and control statement
Variable, constant, operators and control statementVariable, constant, operators and control statement
Variable, constant, operators and control statement
 
visual basic 6.0
visual basic 6.0visual basic 6.0
visual basic 6.0
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
Visual programming
Visual programmingVisual programming
Visual programming
 
Visual Basic
Visual BasicVisual Basic
Visual Basic
 
Turbo c++
Turbo c++Turbo c++
Turbo c++
 
Vb.net (loop structure)
Vb.net (loop structure)Vb.net (loop structure)
Vb.net (loop structure)
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
 
Vb decision making statements
Vb decision making statementsVb decision making statements
Vb decision making statements
 

Ähnlich wie Visual basic 6.0

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 basicsyounganand
 
COM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptxCOM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptxAnasYunusa
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshopdhi her
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0DivyaR219113
 
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
 
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 1guest38bf
 
Book management system
Book management systemBook management system
Book management systemSHARDA SHARAN
 
BIT204 1 Software Fundamentals
BIT204 1 Software FundamentalsBIT204 1 Software Fundamentals
BIT204 1 Software FundamentalsJames Uren
 
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...Make Mannan
 
2 Win7 For Devs Ux Touch Sensors
2 Win7 For Devs Ux Touch Sensors2 Win7 For Devs Ux Touch Sensors
2 Win7 For Devs Ux Touch Sensorsllangit
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfoliomwillmer
 

Ähnlich wie Visual basic 6.0 (20)

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
 
ArduinoWorkshop2.pdf
ArduinoWorkshop2.pdfArduinoWorkshop2.pdf
ArduinoWorkshop2.pdf
 
COM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptxCOM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptx
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshop
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0
 
Ms vb
Ms vbMs vb
Ms vb
 
Visual studio.net
Visual studio.netVisual studio.net
Visual studio.net
 
Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)
 
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
 
Intro To C++ - Class 14 - Midterm Review
Intro To C++ - Class 14 - Midterm ReviewIntro To C++ - Class 14 - Midterm Review
Intro To C++ - Class 14 - Midterm Review
 
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
 
Book management system
Book management systemBook management system
Book management system
 
BIT204 1 Software Fundamentals
BIT204 1 Software FundamentalsBIT204 1 Software Fundamentals
BIT204 1 Software Fundamentals
 
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
 
2 Win7 For Devs Ux Touch Sensors
2 Win7 For Devs Ux Touch Sensors2 Win7 For Devs Ux Touch Sensors
2 Win7 For Devs Ux Touch Sensors
 
Vb.net and .Net Framework
Vb.net and .Net FrameworkVb.net and .Net Framework
Vb.net and .Net Framework
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
 
I x scripting
I x scriptingI x scripting
I x scripting
 

Mehr von Aarti P

Quiz 2014
Quiz 2014Quiz 2014
Quiz 2014Aarti P
 
Quiz 2015
Quiz 2015Quiz 2015
Quiz 2015Aarti P
 
Images and Tables in HTML
Images and Tables in HTMLImages and Tables in HTML
Images and Tables in HTMLAarti P
 
Hyperlinks in HTML
Hyperlinks in HTMLHyperlinks in HTML
Hyperlinks in HTMLAarti P
 
Networks1
Networks1Networks1
Networks1Aarti P
 
Program analysis
Program analysisProgram analysis
Program analysisAarti P
 

Mehr von Aarti P (6)

Quiz 2014
Quiz 2014Quiz 2014
Quiz 2014
 
Quiz 2015
Quiz 2015Quiz 2015
Quiz 2015
 
Images and Tables in HTML
Images and Tables in HTMLImages and Tables in HTML
Images and Tables in HTML
 
Hyperlinks in HTML
Hyperlinks in HTMLHyperlinks in HTML
Hyperlinks in HTML
 
Networks1
Networks1Networks1
Networks1
 
Program analysis
Program analysisProgram analysis
Program analysis
 

Kürzlich hochgeladen

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Kürzlich hochgeladen (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

Visual basic 6.0

  • 1. • Basics of Visual Basic 6 Programming • Design and develop Information Systems with the help of Visual Basic as front-end. Visual Basic 6
  • 2. What is Visual Basic?  It is an “Event Driven Programming Language”  The "Visual" part refers to the method used to create the graphical user interface (GUI). Rather than writing numerous lines of code to describe the appearance and location of interface elements, you simply add prebuilt objects into place on screen.  The "Basic" part refers to the BASIC (Beginners All-Purpose Symbolic Instruction Code) Visual Basic has evolved from the original BASIC language and now contains several hundred statements, functions, and keywords, many of which relate directly to the Windows GUI. Beginners can create useful applications by learning just a few of the keywords, yet the power of the language allows professionals to accomplish anything that can be accomplished using any other Windows programming language
  • 3. Why Visual Basic??  Data access features allow you to create databases, front-end applications, and scalable server-side components for most popular database formats, including Microsoft SQL Server and other enterprise- level databases.  ActiveX™ technologies allow you to use the functionality provided by other applications, such as Microsoft Word word processor, Microsoft Excel spreadsheet, and other Windows applications. You can even automate applications and objects created using Visual Basic.  Internet capabilities make it easy to provide access to documents and applications across the Internet or intranet from within your application, or to create Internet server applications.  Your finished application is a true .exe file that uses a Visual Basic Virtual Machine that you can freely distribute.
  • 4. Interpreting and Compiling  The traditional application development process :  writing  compiling  testing code  Visual Basic uses an interactive approach to development, blurring the distinction between the three steps.  Visual Basic interprets your code as you enter it, catching and highlighting most syntax or spelling errors on the fly. It's almost like having an expert watching over your shoulder as you enter your code.  In addition to catching errors on the fly, Visual Basic also partially compiles the code as it is entered. When you are ready to run and test your application, there is only a brief delay to finish compiling.  Compilation also possible to generate faster applications
  • 5. Key Concepts  windows, events and messages.  Think of a window as simply a rectangular region with its own boundaries.  Explorer window  document window within your word processing program,  dialog box ,Icons, text boxes, option buttons and menu bars are all windows OS manages all of these many windows by assigning each one a unique id number (window handle or hWnd). The system continually monitors each of these windows for signs of activity or events. Events can occur through user actions such as a mouse click or a key press, through programmatic control, or even as a result of another window's actions.  Each time an event occurs, it causes a message to be sent to the operating system. The system processes the message and broadcasts it to the other windows. Each window can then take the appropriate action based on its own instructions for dealing with that particular message (for example, repainting itself when it has been uncovered by another window).  Visual Basic insulates you from having to deal with all of the low-level message handling.
  • 6. Event Driven Programming  In traditional or "procedural" applications, the application itself controls which portions of code execute and in what sequence. Execution starts with the first line of code and follows a predefined path through the application, calling procedures as needed.  In an event-driven application, the code doesn't follow a predetermined path — it executes different code sections in response to events. Events can be triggered by the user's actions, by messages from the system or other applications, or even from the application itself. The sequence of these events determines the sequence in which the code executes, thus the path through the application's code differs each time the program runs.
  • 8. Visual Basic Environment Menu Bar Toolbar Form Toolbox Form Designer Project Explorer Properties Window Form Layout Window
  • 9. Controls Label Text Box Command Button Check Box Option Button Frame Combo Box List Box
  • 10. Control Properties The most common and important object properties are :-  Name  Caption  Left  Top  Height  Width  Enabled  Visible
  • 13. DEMO
  • 14. D A T A T Y P E S A N D V A R I A B L E S W R I T I N G S T A T E M E N T S M A T H O P E R A T I O N S C O N T R O L S T A T E M E N T S F U N C T I O N S Language Basics
  • 15. Data Types  A Data Type is a set of values ,together with a set of operations on those values having certain properties.  Built in Type  User Defined Types
  • 16. Built in Type Type Stores Memory(byte) Range Integer Whole Number 2 -32,768 to +32,767 Long Whole Number 4 +/- 2 billions Single Decimal 4 +/- 1E45 to 3E-38 Double Decimal 8 +/- 5E324 to 1.8E308 Currency 8 +/- 9E14 String Text 1/char <= 65400 char Byte Whole Number 1 0-255 Boolean Logical 2 True/False Date Date & Time 8 1/1/100 to 12/31/9999 Object Instance of Classes 4 N/A Variant Any of above 16 + 1/char N/A
  • 17. Variables  Variables are used to store information in Computer’s memory while programs are running. Three Components that define a variable:  The Variable’s Name  The Type of information being stored  The actual information itself
  • 18. Naming Variable  Rules:  The name must be start with a letter not number or other character.  The remainder of name can contain numbers, letters and/or underscore character. Space ,Punctuation are not allowed.  Name should be unique within variable scope.  The name can be no longer than 255 character.  No reserve words. Syntax: (Explicit Declaration) Dim Var_name As Datatype Example: Dim X As Integer Syntax: (Implicit Declaration) Dim Var_name
  • 19. Constants  Constants are values which remains unchanged. Ex. Const MeterToFeet = 3.3
  • 20. User Defined Types  In addition to Built in Types we can also create User Defined Data Types as follows :-  Ex. Private Type Point x As Integer y As Integer End Type USES: Private Sub Command1_Click() Dim MyPoint As Point MyPoint.x = 3 MyPoint.y = 5 End Sub
  • 21. Writing Statements Statement Type Example Assign a value to a variable sName= “Ankit” Call a Predefined Function MsgBox (“Good Morning”) Call your own function A=fun(“hello”) Assign Object Property Command1.visible = True Make decisions If height > 1000 then MoveOn
  • 22. Using Assignment Statements  Assignments statements are used to assign values to a variable. Assignment Statements Type of Expression S1 = 25 Numeric Literal Str1 = “John” String literal AvgScore = TotScore / n Mathematical Expression Sname = “Mrs. “ & “ Tina” String Expression Cname = Ucases$(“ Chris”) Return value of function
  • 23. Math Operations Operation Operator Uses Addition + Res=num1+ num2 Subtraction - Res=num1-num2 Multiplication * Res=num1*num2 Division / Res=num1/num2 Integer division Res=num1 num2 Modulus mod Res=num1 mod num2 Exponent ^ Res=num1+^num2
  • 24. Strings  Strings can be defined as array of characters.  Strings Functions  Ucase and Lcase  InStr and InStrRev  Left and Right  Mid  Ltrim, Rtrim and Trim  Len  Chr and Asc  Str ,CStr and Val  StrReverse
  • 25. Examples 1. string1 = “himansu” & “ shekhar” output : himansu shekhar 2. Ucase(“Hello”) output: HELLO 3. Lcase(“HeLLo”) Output: hello 4. Pos = InStr(“hi”, “sahoo himansu”) //return 6 5. Pos = InStrRev(“a”, “Nauman”) //return 5 6. Left(“Hello”, 3) //Hel 7. Right(“Hello”,2) //lo 8. Ltrim(“ Hello”) //Hello 9. Trim(“ Hello “) //Hello 10. Len(“Himansu”) //return 7 11. Chr(65) , Asc(‘A’) //return A, 65 12. Str(num), Val(string1) 13. StrReverse(“Hello”) //olleH
  • 26. Decision Making  Using If Statements: Syntax: If <condition> Then command Example: If cSal > cMaxSale Then msgbox(“Greater”) Syntax: If condition Then ……… Else ……… End If Example: If Deposit > 0 Then total = total + Deposit End If
  • 27. Decision Making  Using Multiple If Statements: Syntax: If condition Then ……… ElseIf condition Then ……… Else ……….. End If Example: If Bsal > 12000 Then tSal = 2.5 * Bsal ElseIf Bsal > 10000 Then tSal = 2* Bsal Else tSal = 1.8 * Bsal End If
  • 28. Decision Making  Select Case Examples Syntax: avgNum = total / n Select Case Round(avgNum) Case 100 grade = “EX” Case 80 To 99 grade = “A” ……… End Select
  • 29. Control Statements  For Loop Ex: sum = 0 For i = 1 To 10 sum = sum + i Next i  Do While/Until Loop Ex: sum = 0 i = 1 Do sum = sum + i i = i + 1 Loop While/Until i <= 10
  • 30. Control Statements  While Loop Ex: sum = 0 i = 1 while i > 10 sum = sum + i i = i + 1 wend
  • 31. Functions  Built in Functions  User Defined Functions  Sub Procedures
  • 32. Built in Functions  These are the functions that are the provided with the Visual Basic Package. Some Examples are:  Abs(num)  Left(string, n)  Val(Text1.Text)  Combo1.AddItem  Combo1.Clear  Date
  • 33. User Defined Functions  Visual Basic allows to create user defined functions.  User defined functions that are created by the users for specific operations. Ex 1: Public Function Fun() msgBox(“Hello”) End Function Ex 2: Public Function AddNum(num1 As Integer, num2 As Integer) As Integer AddNum = num1 + num2 End Function
  • 34. Procedures  Procedures can be defined in either of two ways.  Public procedures  Private procedure  These two keywords ( Public and Private ) determines which other programs or procedures have access to your procedures.  Procedures are by default Private.
  • 35. Procedure  Examples: Sub CalRect(nWidth As Integer, nHeight As Integer, nArea As Integer, nPerimeter As Integer) If nWidth <= 0 Or nHeight <= 0 Then Exit Sub End If nArea = nWidth * nHeight nPerimeter = 2 * ( nWidth + nHeight ) End Sub
  • 36. Visual Basic forms and controls are objects which expose their own properties, methods and events. Properties can be thought of as an object's attributes, methods as its actions, and events as its responses. The common events related to several controls are as follows:-  Change – The user modifies the text in a text box or combo box.  Click- The user clicks an object with the primary mouse button( usually the left button).  Dblclick- The user double-clicks an object with the primary mouse button.  DragDrop- The user drags a control to another location.  DragOver- An object is dragged over a control.  GotFocus – An object receives a focus.  KeyDown- A key is pressed while an object has the focus.  KeyPress- A key is pressed and released while an object has the focus.  KeyUp- A key is released while an object has the focus.  MouseDown- A mouse button is pressed while the mouse pointer is over an object.  MouseMove- A mouse cursor is moved over an object.  MouseUp- A mouse button is released while the mouse pointer is over an object. Events