Académique Documents
Professionnel Documents
Culture Documents
Is
Lots
Response
Clipboard
Full
Can
Sequential
Useful
Powerful
ActiveX
support.
Package
Controls
- Graphical features drawn on forms to allow user interaction (text boxes, labels, scroll
bars, command buttons, etc.) (Forms and Controls are objects.).
Properties
Methods
- Built-in procedure that can be invoked to impart some action to a particular object.
Event
Procedures - Code related to some object. This is the code that is executed when a
certain event occurs.
General
Procedures - Code not related to objects. This code must be invoked by the
application.
Modules
2. Assign
properties to controls.
3. Attach
code to controls
Variables
Variables
(Integer)
Single
(Floating)
Double
(Floating)
Currency
Date
Object
String
Variant
Dim
MyInt as Integer
Dim MyDouble as Double
Dim MyString, YourString as String
StartTime = Now
Explorer.Caption = "Captain Spaulding"
BitCount = ByteCount * 8
Energy = Mass * LIGHTSPEED ^ 2
NetWorth = Assets - Liabilities
Exponentiation
*/
Mod
+-
Operation
Modulus
Addition and subutraction
comparison operators
There are six comparison operators in Visual Basic:
Operator
Comparison
>
Greater than
<
Less than
>=
<=
Equal to
<>
Not equal to
Logical Operators
We will use three logical operators
Operator
Operation
Not
Logical not
And
Logical and
Or
Logical or
The
The
And operator returns a True if both operands are True. Else, it returns a False.
The
If Statements
The
You
In this case, if Balance - Check is less than zero, two lines of information are printed.
Or,
If/Then/Else/End If blocks:
Or,
Do
While/Loop Example:
Counter = 1
Do While Counter <= 1000
Debug.Print Counter
Counter = Counter + 1
Loop
Do
Until/Loop Example:
Counter = 1
Do Until Counter > 1000
Debug.Print Counter
Counter = Counter + 1
Loop
Do/Loop
While Example:
Sum = 1
Do
Debug.Print Sum
Sum = Sum + 3
Loop While Sum <= 50
Do/Loop
Until Example:
Sum = 1
Do
Debug.Print Sum
Sum = Sum + 3
Loop Until Sum > 50
For/Next loop
Counting is accomplished using the For/Next loop.
Example
For I = 1 to 50 Step 2
A=I*2
Debug.Print A
Next I
is a set of programmable
objects
Visual Basic Application (VBA) is an
object oriented programming language
oriented programming language
VBA is included with ArcGIS Desktop
(ArcMap and ArcCatalog);
Startingthe
theVisual
VisualBasic
Basic
Starting
Editor:
Editor:
ArcObject