SlideShare a Scribd company logo
1 of 48
Download to read offline
Visual Basic Programming
An Introduction
Why Visual Basic?
H Programming for the Windows User
Interface is extremely complicated.
H Other Graphical User Interfaces (GUI) are
no better.
H Visual Basic provides a convenient method
for building user interfaces.
H Visual Basic can interface with code written
in C, for efficiency.
What Visual Basic is not
H Visual Basic is not, a powerful
programming language that enables you to
do anything you want.
H Visual Basic is not, elegant or fast.
H Visual Basic is not, a replacement for C.
H Visual Basic is not, anything like any other
programming language you have ever used.
When You Program in VB:
H You draw pictures of your user interface.
H You draw buttons, text boxes, and other
user-interface items.
H You add little snippets of code to handle the
user interaction.
H You add initialization code, usually as the
last step.
H If you like, you can code more complex
functions. (But many do not.)
The Visual Basic Interface
Draw Your
Program
Here!
Drawing The Program
Select A Control From Here
(Click on the appropriate button)
Then Draw the control on the form
Types of Controls
Static Text
Group Box
Check Box
Scroll Bar
Timer
Folder Hierarchy
Circles and Stuff
Pictures
Pictures
Editable Text
Button
Radio Button
Drop-Down List List
Drive List
File List
Lines
Data Base Access
Scroll Bar
And the List Goes On and On ...
A Simple Program
Double-Click to
Add Code
Single-Click to
Select and
Change
Properties
Using controls: Static Text
Editable Text
Buttons
The Properties Window
List of Properties
For Currently Selected
Control
Click on Property, and
Type In New Value, or
Select New Value From
Menu.
Adding Code
Control
Name
External Event
Name
What to Do When It Happens
You must Write
The Body
Yourself
More Complex Controls
H Complex Controls Have:
– Action Properties to Execute Commands
– Active Properties that Cause Actions When
Values Are Assigned to Them
– Many Types of Events for Program Interaction
H Examples:
– Spreadsheets
– Word Processors
– Web Browsers
Using C Code
H Write a DLL in C
H Use the _export Property on Appropriate
Functions
H Write Visual Basic Definitions for each
Function
H Add VB Definitions to The (general)
section of the VB Program
H Use Functions as if they were VB functions
C Definition vs. VB Definition
Declare Function HexToLong Lib “FIRSTONE.DLL”
(ByVal InString As String) As Long
long FAR PASCAL _export HexToLong (char *Hex)
C:
VB:
Function Name Must Be The Same in Both Declarations.
The Lib keyword Must Give The Name of the Library.
Argument Name in VB is arbitrary.
A (Very Annoying) Problem
H It is sometimes difficult for VB to FIND the
.DLL file.
H If this occurs, copy the .DLL file to the
WINDOWS directory.
H Remember to Delete the file when you are
done.
Alternative Methods
H Some Versions of VB do not allow DLL
function definitions in the (general) section
of a form.
H To Get Around this Problem, Create a new
Module (File Menu)
H Add the declarations to the (general) section
of the module
H You can add your own VB functions to the
(general) section of a form or a module.
Syntax Considerations
H All Functions are Global in VB
H Variables are declared using the syntax:
– Dim <Name> As <Type>
– Every variable must have a type
– Dim A,B,C As <Type> will work, but gives
weird results
H Most Common Types: Integer, String, Long
More VB Syntax
H Use Integers for Booleans
– As in C, 0 = False, everything else = True
– Symbolic constants True and False may be used
– True = -1, False = 0
H Assignments are the same as in C
H The Val function converts strings to integers
H The Format$ function converts integers to
strings
VB Statements
H Assignments are the Same as in C
H Case is not significant
– Case will be adjusted for you on keywords
– For Variable Names, Case is ignored
H The Usual Operators can be used
– AND is the same as both & and && depending
on context
– OR = | and ||
– NOT = !
VB IF Statements
If <condition> Then
<List of Statements>
Else
<List of Statements>
EndIf
If <condition> Then
<List of Statements>
EndIf
DON’T FORGET THE ENDIF!
Comparators: =,<, >, <=, >=, < > (not equal)
Connectives: And, Or, Not
VB While Statements
While <condition> do
<List of Statements>
Wend
The VB Manual Recommends a different structure.
Use the alternative if you wish.
VB For Statements
For <Variable> = <start> to <finish>
<List of Statements>
Next <Variable>
For <Variable> = <start> to <finish> Step <increment>
<List of Statements>
Next <Variable>
Example:
For I = 1 to 10 do
A[I] = A[I] + 1
Next I
VB Arrays
H Indices Always Start With Zero
H Dim A[10] As Integer Declares 11 elements,
indexed from 0 through 10.
H Multi-Dimensional Arrays are Permitted.
H Arrays can be resized at run time (See VB
Help File for ReDim)
VB Strings
H Variable Length
H Compare using standard comparators
H Maximum length is about 64Kb
H Minimum length is zero
H Allocated from VB “String Space”, so may
run out of space even on systems with much
memory.
And in Conclusion ...
Go
Have
Fun!
Visual Basic Programming
An Introduction
Why Visual Basic?
H Programming for the Windows User
Interface is extremely complicated.
H Other Graphical User Interfaces (GUI) are
no better.
H Visual Basic provides a convenient method
for building user interfaces.
H Visual Basic can interface with code written
in C, for efficiency.
What Visual Basic is not
H Visual Basic is not, a powerful
programming language that enables you to
do anything you want.
H Visual Basic is not, elegant or fast.
H Visual Basic is not, a replacement for C.
H Visual Basic is not, anything like any other
programming language you have ever used.
When You Program in VB:
H You draw pictures of your user interface.
H You draw buttons, text boxes, and other
user-interface items.
H You add little snippets of code to handle the
user interaction.
H You add initialization code, usually as the
last step.
H If you like, you can code more complex
functions. (But many do not.)
The Visual Basic Interface
Draw Your
Program
Here!
Drawing The Program
Select A Control From Here
(Click on the appropriate button)
Then Draw the control on the form
Types of Controls
Static Text
Group Box
Check Box
Scroll Bar
Timer
Folder Hierarchy
Circles and Stuff
Pictures
Pictures
Editable TextEditable Text
Button
Radio Button
Drop-Down List List
Drive List
File List
Lines
Data Base Access
Scroll Bar
And the List Goes On and On ...
A Simple Program
Double-Click to
Add Code
Single-Click to
Select and
Change
Properties
Using controls: Static Text
Editable Text
Buttons
The Properties Window
List of Properties
For Currently Selected
Control
Click on Property, and
Type In New Value, or
Select New Value From
Menu.
Adding Code
Control
Name
External Event
Name
What to Do When It Happens
You must Write
The Body
Yourself
More Complex Controls
H Complex Controls Have:
– Action Properties to Execute Commands
– Active Properties that Cause Actions When
Values Are Assigned to Them
– Many Types of Events for Program Interaction
H Examples:
– Spreadsheets
– Word Processors
– Web Browsers
Using C Code
H Write a DLL in C
H Use the _export Property on Appropriate
Functions
H Write Visual Basic Definitions for each
Function
H Add VB Definitions to The (general)
section of the VB Program
H Use Functions as if they were VB functions
C Definition vs. VB Definition
Declare Function HexToLong Lib “FIRSTONE.DLL”
(ByVal InString As String) As Long
long FAR PASCAL _export HexToLong (char *Hex)
C:
VB:
Function Name Must Be The Same in Both Declarations.
The Lib keyword Must Give The Name of the Library.
Argument Name in VB is arbitrary.
A (Very Annoying) Problem
H It is sometimes difficult for VB to FIND the
.DLL file.
H If this occurs, copy the .DLL file to the
WINDOWS directory.
H Remember to Delete the file when you are
done.
Alternative Methods
H Some Versions of VB do not allow DLL
function definitions in the (general) section
of a form.
H To Get Around this Problem, Create a new
Module (File Menu)
H Add the declarations to the (general) section
of the module
H You can add your own VB functions to the
(general) section of a form or a module.
Syntax Considerations
H All Functions are Global in VB
H Variables are declared using the syntax:
– Dim <Name> As <Type>
– Every variable must have a type
– Dim A,B,C As <Type> will work, but gives
weird results
H Most Common Types: Integer, String, Long
More VB Syntax
H Use Integers for Booleans
– As in C, 0 = False, everything else = True
– Symbolic constants True and False may be used
– True = -1, False = 0
H Assignments are the same as in C
H The Val function converts strings to integers
H The Format$ function converts integers to
strings
VB Statements
H Assignments are the Same as in C
H Case is not significant
– Case will be adjusted for you on keywords
– For Variable Names, Case is ignored
H The Usual Operators can be used
– AND is the same as both & and && depending
on context
– OR = | and ||
– NOT = !
VB IF Statements
If <condition> Then
<List of Statements>
Else
<List of Statements>
EndIf
If <condition> Then
<List of Statements>
EndIf
DON’T FORGET THE ENDIF!
Comparators: =,<, >, <=, >=, < > (not equal)
Connectives: And, Or, Not
VB While Statements
While <condition> do
<List of Statements>
Wend
The VB Manual Recommends a different structure.
Use the alternative if you wish.
VB For Statements
For <Variable> = <start> to <finish>
<List of Statements>
Next <Variable>
For <Variable> = <start> to <finish> Step <increment>
<List of Statements>
Next <Variable>
Example:
For I = 1 to 10 do
A[I] = A[I] + 1
Next I
VB Arrays
H Indices Always Start With Zero
H Dim A[10] As Integer Declares 11 elements,
indexed from 0 through 10.
H Multi-Dimensional Arrays are Permitted.
H Arrays can be resized at run time (See VB
Help File for ReDim)
VB Strings
H Variable Length
H Compare using standard comparators
H Maximum length is about 64Kb
H Minimum length is zero
H Allocated from VB “String Space”, so may
run out of space even on systems with much
memory.
And in Conclusion ...
Go
Have
Fun!

More Related Content

What's hot

Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programmingRoger Argarin
 
Visual basic
Visual basicVisual basic
Visual basicsanjay joshi
 
Vb6.0 Introduction
Vb6.0 IntroductionVb6.0 Introduction
Vb6.0 IntroductionTennyson
 
Visual basic 6
Visual basic 6Visual basic 6
Visual basic 6Spy Seat
 
Visual Programming
Visual ProgrammingVisual Programming
Visual ProgrammingBagzzz
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0sanket1996
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE IntroductionAhllen Javier
 
Visual basic
Visual basicVisual basic
Visual basicumesh patil
 
Vb lecture
Vb lectureVb lecture
Vb lecturealldesign
 
Introduction to visual basic
Introduction to visual basicIntroduction to visual basic
Introduction to visual basicManav Khandelwal
 
Chapter 01: Intro to VB2010 Programming
Chapter 01: Intro to VB2010 ProgrammingChapter 01: Intro to VB2010 Programming
Chapter 01: Intro to VB2010 Programmingpatf719
 
Best practices for upgrading vb 6.0 projects to vb.net
Best practices for upgrading vb 6.0 projects to vb.netBest practices for upgrading vb 6.0 projects to vb.net
Best practices for upgrading vb 6.0 projects to vb.netajmal_fuuast
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls pptRanjuma Shubhangi
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.sagaroceanic11
 
Creating a data report in visual basic 6
Creating a data report in visual basic 6Creating a data report in visual basic 6
Creating a data report in visual basic 6mrgulshansharma
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introductionbloodyedge03
 
visual basic programming
visual basic programmingvisual basic programming
visual basic programmingsowndaryadharmaraj
 
Chapter 03 - Program Coding and Design
Chapter 03 - Program Coding and DesignChapter 03 - Program Coding and Design
Chapter 03 - Program Coding and Designpatf719
 
Visual Basic Programming
Visual Basic ProgrammingVisual Basic Programming
Visual Basic ProgrammingOsama Yaseen
 
Visual basic concepts
Visual basic conceptsVisual basic concepts
Visual basic conceptsmelody77776
 

What's hot (20)

Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
 
Visual basic
Visual basicVisual basic
Visual basic
 
Vb6.0 Introduction
Vb6.0 IntroductionVb6.0 Introduction
Vb6.0 Introduction
 
Visual basic 6
Visual basic 6Visual basic 6
Visual basic 6
 
Visual Programming
Visual ProgrammingVisual Programming
Visual Programming
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE Introduction
 
Visual basic
Visual basicVisual basic
Visual basic
 
Vb lecture
Vb lectureVb lecture
Vb lecture
 
Introduction to visual basic
Introduction to visual basicIntroduction to visual basic
Introduction to visual basic
 
Chapter 01: Intro to VB2010 Programming
Chapter 01: Intro to VB2010 ProgrammingChapter 01: Intro to VB2010 Programming
Chapter 01: Intro to VB2010 Programming
 
Best practices for upgrading vb 6.0 projects to vb.net
Best practices for upgrading vb 6.0 projects to vb.netBest practices for upgrading vb 6.0 projects to vb.net
Best practices for upgrading vb 6.0 projects to vb.net
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 
Creating a data report in visual basic 6
Creating a data report in visual basic 6Creating a data report in visual basic 6
Creating a data report in visual basic 6
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introduction
 
visual basic programming
visual basic programmingvisual basic programming
visual basic programming
 
Chapter 03 - Program Coding and Design
Chapter 03 - Program Coding and DesignChapter 03 - Program Coding and Design
Chapter 03 - Program Coding and Design
 
Visual Basic Programming
Visual Basic ProgrammingVisual Basic Programming
Visual Basic Programming
 
Visual basic concepts
Visual basic conceptsVisual basic concepts
Visual basic concepts
 

Viewers also liked

Introduction to Visual Basic (Week 2)
Introduction to Visual Basic (Week 2)Introduction to Visual Basic (Week 2)
Introduction to Visual Basic (Week 2)Don Bosco School Manila
 
C lecture 3 control statements slideshare
C lecture 3 control statements slideshareC lecture 3 control statements slideshare
C lecture 3 control statements slideshareGagan Deep
 
Steps to migrate vb6 application to vb dotnet
Steps to migrate vb6 application to vb dotnetSteps to migrate vb6 application to vb dotnet
Steps to migrate vb6 application to vb dotnetDebabrata Adhya
 
.Net branching and flow control
.Net branching and flow control.Net branching and flow control
.Net branching and flow controlLearnNowOnline
 
VB Function and procedure
VB Function and procedureVB Function and procedure
VB Function and procedurepragya ratan
 
Vb decision making statements
Vb decision making statementsVb decision making statements
Vb decision making statementspragya ratan
 
Control Structures in Visual Basic
Control Structures in  Visual BasicControl Structures in  Visual Basic
Control Structures in Visual BasicTushar Jain
 
Decision statements in vb.net
Decision statements in vb.netDecision statements in vb.net
Decision statements in vb.netilakkiya
 
Looping statement in vb.net
Looping statement in vb.netLooping statement in vb.net
Looping statement in vb.netilakkiya
 
Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in JavaJin Castor
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare pptMandy Suzanne
 

Viewers also liked (12)

Introduction to Visual Basic (Week 2)
Introduction to Visual Basic (Week 2)Introduction to Visual Basic (Week 2)
Introduction to Visual Basic (Week 2)
 
C lecture 3 control statements slideshare
C lecture 3 control statements slideshareC lecture 3 control statements slideshare
C lecture 3 control statements slideshare
 
Steps to migrate vb6 application to vb dotnet
Steps to migrate vb6 application to vb dotnetSteps to migrate vb6 application to vb dotnet
Steps to migrate vb6 application to vb dotnet
 
.Net branching and flow control
.Net branching and flow control.Net branching and flow control
.Net branching and flow control
 
VB Function and procedure
VB Function and procedureVB Function and procedure
VB Function and procedure
 
Vb decision making statements
Vb decision making statementsVb decision making statements
Vb decision making statements
 
Control Structures in Visual Basic
Control Structures in  Visual BasicControl Structures in  Visual Basic
Control Structures in Visual Basic
 
Decision statements in vb.net
Decision statements in vb.netDecision statements in vb.net
Decision statements in vb.net
 
Looping statement in vb.net
Looping statement in vb.netLooping statement in vb.net
Looping statement in vb.net
 
Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
 
Control statements
Control statementsControl statements
Control statements
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
 

Similar to Vbasic

Intro_to_VB.PPT
Intro_to_VB.PPTIntro_to_VB.PPT
Intro_to_VB.PPTVishalMali76
 
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1ILearn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1Ilivecoding.tv
 
Cordovilla
CordovillaCordovilla
Cordovillabrianmae002
 
C programming languag for cse students
C programming languag for cse studentsC programming languag for cse students
C programming languag for cse studentsAbdur Rahim
 
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfINTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfSubramanyambharathis
 
Unit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdfUnit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdfUjwala Junghare
 
Web Design & Development - Session 7
Web Design & Development - Session 7Web Design & Development - Session 7
Web Design & Development - Session 7Shahrzad Peyman
 
BIS07 Application Development - I
BIS07 Application Development - IBIS07 Application Development - I
BIS07 Application Development - IPrithwis Mukerjee
 
Basics of c++
Basics of c++Basics of c++
Basics of c++Huba Akhtar
 
Programming in c
Programming in cProgramming in c
Programming in cankitjain851
 
Basics1
Basics1Basics1
Basics1phanleson
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance levelsajjad ali khan
 

Similar to Vbasic (20)

Intro_to_VB.PPT
Intro_to_VB.PPTIntro_to_VB.PPT
Intro_to_VB.PPT
 
programming.ppt
programming.pptprogramming.ppt
programming.ppt
 
C programming
C programmingC programming
C programming
 
C programming
C programmingC programming
C programming
 
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1ILearn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
 
Cordovilla
CordovillaCordovilla
Cordovilla
 
C programming languag for cse students
C programming languag for cse studentsC programming languag for cse students
C programming languag for cse students
 
Programming
ProgrammingProgramming
Programming
 
Vb script in asp
Vb script in aspVb script in asp
Vb script in asp
 
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfINTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
 
Unit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdfUnit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdf
 
Web Design & Development - Session 7
Web Design & Development - Session 7Web Design & Development - Session 7
Web Design & Development - Session 7
 
Basic c
Basic cBasic c
Basic c
 
C# Dot net unit-3.pdf
C# Dot net unit-3.pdfC# Dot net unit-3.pdf
C# Dot net unit-3.pdf
 
BIS07 Application Development - I
BIS07 Application Development - IBIS07 Application Development - I
BIS07 Application Development - I
 
Basics of c++
Basics of c++Basics of c++
Basics of c++
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Basics1
Basics1Basics1
Basics1
 
ASP.NET Basics
ASP.NET Basics ASP.NET Basics
ASP.NET Basics
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
 

Recently uploaded

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
WhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 

Recently uploaded (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
WhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 âś“Call Girls In Kalyan ( Mumbai ) secure service
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 

Vbasic

  • 2. Why Visual Basic? H Programming for the Windows User Interface is extremely complicated. H Other Graphical User Interfaces (GUI) are no better. H Visual Basic provides a convenient method for building user interfaces. H Visual Basic can interface with code written in C, for efficiency.
  • 3. What Visual Basic is not H Visual Basic is not, a powerful programming language that enables you to do anything you want. H Visual Basic is not, elegant or fast. H Visual Basic is not, a replacement for C. H Visual Basic is not, anything like any other programming language you have ever used.
  • 4. When You Program in VB: H You draw pictures of your user interface. H You draw buttons, text boxes, and other user-interface items. H You add little snippets of code to handle the user interaction. H You add initialization code, usually as the last step. H If you like, you can code more complex functions. (But many do not.)
  • 5. The Visual Basic Interface Draw Your Program Here!
  • 6. Drawing The Program Select A Control From Here (Click on the appropriate button) Then Draw the control on the form
  • 7. Types of Controls Static Text Group Box Check Box Scroll Bar Timer Folder Hierarchy Circles and Stuff Pictures Pictures Editable Text Button Radio Button Drop-Down List List Drive List File List Lines Data Base Access Scroll Bar And the List Goes On and On ...
  • 8. A Simple Program Double-Click to Add Code Single-Click to Select and Change Properties Using controls: Static Text Editable Text Buttons
  • 9. The Properties Window List of Properties For Currently Selected Control Click on Property, and Type In New Value, or Select New Value From Menu.
  • 10. Adding Code Control Name External Event Name What to Do When It Happens You must Write The Body Yourself
  • 11. More Complex Controls H Complex Controls Have: – Action Properties to Execute Commands – Active Properties that Cause Actions When Values Are Assigned to Them – Many Types of Events for Program Interaction H Examples: – Spreadsheets – Word Processors – Web Browsers
  • 12. Using C Code H Write a DLL in C H Use the _export Property on Appropriate Functions H Write Visual Basic Definitions for each Function H Add VB Definitions to The (general) section of the VB Program H Use Functions as if they were VB functions
  • 13. C Definition vs. VB Definition Declare Function HexToLong Lib “FIRSTONE.DLL” (ByVal InString As String) As Long long FAR PASCAL _export HexToLong (char *Hex) C: VB: Function Name Must Be The Same in Both Declarations. The Lib keyword Must Give The Name of the Library. Argument Name in VB is arbitrary.
  • 14. A (Very Annoying) Problem H It is sometimes difficult for VB to FIND the .DLL file. H If this occurs, copy the .DLL file to the WINDOWS directory. H Remember to Delete the file when you are done.
  • 15. Alternative Methods H Some Versions of VB do not allow DLL function definitions in the (general) section of a form. H To Get Around this Problem, Create a new Module (File Menu) H Add the declarations to the (general) section of the module H You can add your own VB functions to the (general) section of a form or a module.
  • 16. Syntax Considerations H All Functions are Global in VB H Variables are declared using the syntax: – Dim <Name> As <Type> – Every variable must have a type – Dim A,B,C As <Type> will work, but gives weird results H Most Common Types: Integer, String, Long
  • 17. More VB Syntax H Use Integers for Booleans – As in C, 0 = False, everything else = True – Symbolic constants True and False may be used – True = -1, False = 0 H Assignments are the same as in C H The Val function converts strings to integers H The Format$ function converts integers to strings
  • 18. VB Statements H Assignments are the Same as in C H Case is not significant – Case will be adjusted for you on keywords – For Variable Names, Case is ignored H The Usual Operators can be used – AND is the same as both & and && depending on context – OR = | and || – NOT = !
  • 19. VB IF Statements If <condition> Then <List of Statements> Else <List of Statements> EndIf If <condition> Then <List of Statements> EndIf DON’T FORGET THE ENDIF! Comparators: =,<, >, <=, >=, < > (not equal) Connectives: And, Or, Not
  • 20. VB While Statements While <condition> do <List of Statements> Wend The VB Manual Recommends a different structure. Use the alternative if you wish.
  • 21. VB For Statements For <Variable> = <start> to <finish> <List of Statements> Next <Variable> For <Variable> = <start> to <finish> Step <increment> <List of Statements> Next <Variable> Example: For I = 1 to 10 do A[I] = A[I] + 1 Next I
  • 22. VB Arrays H Indices Always Start With Zero H Dim A[10] As Integer Declares 11 elements, indexed from 0 through 10. H Multi-Dimensional Arrays are Permitted. H Arrays can be resized at run time (See VB Help File for ReDim)
  • 23. VB Strings H Variable Length H Compare using standard comparators H Maximum length is about 64Kb H Minimum length is zero H Allocated from VB “String Space”, so may run out of space even on systems with much memory.
  • 24. And in Conclusion ... Go Have Fun!
  • 26. Why Visual Basic? H Programming for the Windows User Interface is extremely complicated. H Other Graphical User Interfaces (GUI) are no better. H Visual Basic provides a convenient method for building user interfaces. H Visual Basic can interface with code written in C, for efficiency.
  • 27. What Visual Basic is not H Visual Basic is not, a powerful programming language that enables you to do anything you want. H Visual Basic is not, elegant or fast. H Visual Basic is not, a replacement for C. H Visual Basic is not, anything like any other programming language you have ever used.
  • 28. When You Program in VB: H You draw pictures of your user interface. H You draw buttons, text boxes, and other user-interface items. H You add little snippets of code to handle the user interaction. H You add initialization code, usually as the last step. H If you like, you can code more complex functions. (But many do not.)
  • 29. The Visual Basic Interface Draw Your Program Here!
  • 30. Drawing The Program Select A Control From Here (Click on the appropriate button) Then Draw the control on the form
  • 31. Types of Controls Static Text Group Box Check Box Scroll Bar Timer Folder Hierarchy Circles and Stuff Pictures Pictures Editable TextEditable Text Button Radio Button Drop-Down List List Drive List File List Lines Data Base Access Scroll Bar And the List Goes On and On ...
  • 32. A Simple Program Double-Click to Add Code Single-Click to Select and Change Properties Using controls: Static Text Editable Text Buttons
  • 33. The Properties Window List of Properties For Currently Selected Control Click on Property, and Type In New Value, or Select New Value From Menu.
  • 34. Adding Code Control Name External Event Name What to Do When It Happens You must Write The Body Yourself
  • 35. More Complex Controls H Complex Controls Have: – Action Properties to Execute Commands – Active Properties that Cause Actions When Values Are Assigned to Them – Many Types of Events for Program Interaction H Examples: – Spreadsheets – Word Processors – Web Browsers
  • 36. Using C Code H Write a DLL in C H Use the _export Property on Appropriate Functions H Write Visual Basic Definitions for each Function H Add VB Definitions to The (general) section of the VB Program H Use Functions as if they were VB functions
  • 37. C Definition vs. VB Definition Declare Function HexToLong Lib “FIRSTONE.DLL” (ByVal InString As String) As Long long FAR PASCAL _export HexToLong (char *Hex) C: VB: Function Name Must Be The Same in Both Declarations. The Lib keyword Must Give The Name of the Library. Argument Name in VB is arbitrary.
  • 38. A (Very Annoying) Problem H It is sometimes difficult for VB to FIND the .DLL file. H If this occurs, copy the .DLL file to the WINDOWS directory. H Remember to Delete the file when you are done.
  • 39. Alternative Methods H Some Versions of VB do not allow DLL function definitions in the (general) section of a form. H To Get Around this Problem, Create a new Module (File Menu) H Add the declarations to the (general) section of the module H You can add your own VB functions to the (general) section of a form or a module.
  • 40. Syntax Considerations H All Functions are Global in VB H Variables are declared using the syntax: – Dim <Name> As <Type> – Every variable must have a type – Dim A,B,C As <Type> will work, but gives weird results H Most Common Types: Integer, String, Long
  • 41. More VB Syntax H Use Integers for Booleans – As in C, 0 = False, everything else = True – Symbolic constants True and False may be used – True = -1, False = 0 H Assignments are the same as in C H The Val function converts strings to integers H The Format$ function converts integers to strings
  • 42. VB Statements H Assignments are the Same as in C H Case is not significant – Case will be adjusted for you on keywords – For Variable Names, Case is ignored H The Usual Operators can be used – AND is the same as both & and && depending on context – OR = | and || – NOT = !
  • 43. VB IF Statements If <condition> Then <List of Statements> Else <List of Statements> EndIf If <condition> Then <List of Statements> EndIf DON’T FORGET THE ENDIF! Comparators: =,<, >, <=, >=, < > (not equal) Connectives: And, Or, Not
  • 44. VB While Statements While <condition> do <List of Statements> Wend The VB Manual Recommends a different structure. Use the alternative if you wish.
  • 45. VB For Statements For <Variable> = <start> to <finish> <List of Statements> Next <Variable> For <Variable> = <start> to <finish> Step <increment> <List of Statements> Next <Variable> Example: For I = 1 to 10 do A[I] = A[I] + 1 Next I
  • 46. VB Arrays H Indices Always Start With Zero H Dim A[10] As Integer Declares 11 elements, indexed from 0 through 10. H Multi-Dimensional Arrays are Permitted. H Arrays can be resized at run time (See VB Help File for ReDim)
  • 47. VB Strings H Variable Length H Compare using standard comparators H Maximum length is about 64Kb H Minimum length is zero H Allocated from VB “String Space”, so may run out of space even on systems with much memory.
  • 48. And in Conclusion ... Go Have Fun!