BUY THIS BOOK
Add to Cart

Print Book $9.95


Add to Cart

Print+PDF $12.93

Add to Cart

PDF $7.99

Safari Books Online

What is this?

Add to UK Cart

Print Book £6.95

What is this?

Looking to Reprint or License this content?


VB.NET Language Pocket Reference
VB.NET Language Pocket Reference By Steven Roman, Ph.D., Ron Petrusha, Paul Lomax
December 2002
Pages: 150

Cover | Table of Contents


Table of Contents

Chapter 1: Visual Basic .NET Language Pocket Reference
Visual Basic .NET is a radically new version of Microsoft Visual Basic, the world's most widely used rapid application development (RAD) package. Visual Basic .NET is designed to work directly with Microsoft's .NET platform, which includes a Framework Class Library to facilitate application development, a Common Language Runtime to provide a managed execution environment, and a Common Type System to insure interoperability among all languages that support the .NET platform.
The Visual Basic .NET Language Pocket Reference is a quick reference guide to Visual Basic 7.0, the first version of Visual Basic .NET. It contains a concise description of all language elements by category. These include language elements implemented by the Visual Basic compiler, as well as all procedures and functions implemented in the Microsoft.VisualBasic namespace. It does not attempt to document the core classes of the .NET Framework Class Library.
The purpose of this quick reference is to aid readers who need to look up some basic detail of Visual Basic syntax or usage. It is not intended to be a tutorial or user guide; at least a basic familiarity with Visual Basic is assumed.
Constant Width
Used to indicate code examples, types and type members, statements, constants, and keywords.
Constant Width Italic
Used to indicate replaceable parameters.
Italic
Used to indicate new terms, filenames, URLs, and email addresses.
The "rules" for Visual Basic (VB) code are very simple:
  • VB is a case-insensitive programming language; that is, the compiler ignores case when reading VB code. So myVar, MyVar, MYvar, and MYVAR all refer to the same variable. Note that Visual Studio imposes a uniform casing on all language elements, although this is not a requirement of the compiler.
  • White space (except for line breaks) is ignored when reading VB code.
  • Line breaks mark the end of a complete statement; complete VB statements must occupy a single line.
  • If you want to break a single statement over several lines, you can use the line continuation character, an underscore (_), which must be preceded by a space and must be the last character on the line that is to be continued.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Introduction
Visual Basic .NET is a radically new version of Microsoft Visual Basic, the world's most widely used rapid application development (RAD) package. Visual Basic .NET is designed to work directly with Microsoft's .NET platform, which includes a Framework Class Library to facilitate application development, a Common Language Runtime to provide a managed execution environment, and a Common Type System to insure interoperability among all languages that support the .NET platform.
The Visual Basic .NET Language Pocket Reference is a quick reference guide to Visual Basic 7.0, the first version of Visual Basic .NET. It contains a concise description of all language elements by category. These include language elements implemented by the Visual Basic compiler, as well as all procedures and functions implemented in the Microsoft.VisualBasic namespace. It does not attempt to document the core classes of the .NET Framework Class Library.
The purpose of this quick reference is to aid readers who need to look up some basic detail of Visual Basic syntax or usage. It is not intended to be a tutorial or user guide; at least a basic familiarity with Visual Basic is assumed.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Font Conventions
Constant Width
Used to indicate code examples, types and type members, statements, constants, and keywords.
Constant Width Italic
Used to indicate replaceable parameters.
Italic
Used to indicate new terms, filenames, URLs, and email addresses.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Visual Basic Conventions
The "rules" for Visual Basic (VB) code are very simple:
  • VB is a case-insensitive programming language; that is, the compiler ignores case when reading VB code. So myVar, MyVar, MYvar, and MYVAR all refer to the same variable. Note that Visual Studio imposes a uniform casing on all language elements, although this is not a requirement of the compiler.
  • White space (except for line breaks) is ignored when reading VB code.
  • Line breaks mark the end of a complete statement; complete VB statements must occupy a single line.
  • If you want to break a single statement over several lines, you can use the line continuation character, an underscore (_), which must be preceded by a space and must be the last character on the line that is to be continued.
  • If you want to combine multiple statements on a single line, you can use the colon (:). Among other uses, it is commonly used to imitate C++ and C# syntax for inheritance. For example, the code fragment:
    Public Class MainForm
       Inherits Form 
    can be shortened as follows:
    Public Class MainForm : Inherits Form
  • Two comment symbols are used: the apostrophe (') and the Rem keyword. They may appear at any place within a line.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Data Types
Whether VB is a weakly or a semi-strongly typed language depends on the Option Explicit setting. (The statement must appear at the top of a code module.) If Off, VB is a weakly typed language; variables need not be declared in advance, and all undeclared variables will be cast as type Object until they are initialized. If On (its default setting), each variable must be declared in advance, but its data type need not be specified. If no type is explicitly declared, variables are cast as type Object until their first use.
Although VB recognizes a number of "intrinsic" data types, each is really a wrapper around a data type found in the .NET Common Type System (CTS). VB recognizes the following intrinsic types:
Boolean
A logical (True or False) value. Corresponds to System.Boolean.
Byte
A signed 8-bit numeric data type. Corresponds to System.Byte.
Char
A 16-bit character data type (character code). Corresponds to System.Char.
Date
A date or time value. Corresponds to System.DataTime.
Decimal
A decimal or currency value. Corresponds to System.Decimal.
Double
A double-precision floating point value. Corresponds to System.Double.
Integer
A signed 32-bit integral data type. Corresponds to System.Int32.
Long
A signed 64-bit integral data type. Corresponds to System.Int64.
Object
A reference to an object. Object is VB's "universal" data type and corresponds to System.Object.
Short
A signed 16-bit integral data type. Corresponds to System.Int16.
Single
A single-precision floating point value. Corresponds to System.Single.
String
A reference type pointing to a fixed-length character string. Corresponds to System.String.
A number of other data types are available from the .NET CTS but are not wrapped by a corresponding VB intrinsic data type. These include:
System.SByte
A signed 8-bit integral data type.
System.UInt16
An unsigned 16-bit integral data type.
System.UInt32
An unsigned 32-bit integral data type.
System.UInt64
An unsigned 64-bit integral data type.
VB also allows you to create user-defined reference types by using the
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Variables
VB does not require that variables be declared before they are used unless Option Explicit is On (its default value). In that case, you can declare variables using the Dim, Public, Private, Protected, Friend, or Protected Friend statements.
A variable name in VB must satisfy the following requirements:
  • It must be 16,383 or fewer characters in length.
  • It must begin with an alphabetic character or an underscore.
  • It cannot include embedded spaces.
  • It cannot contain any special (i.e., non-alphabetic, non-numeric) character other than an underscore.
  • It must be unique within its scope.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Operators and Precedence
VB supports the following operators:
Operator
Description
+
Addition, string concatenation
+=
Increment and assign
-
Subtraction, unary operator
-=
Subtract and assign
/
Division
/=
Divide and assign
\
Integer division (no remainder)
\=
Integer division and assignment
Mod
Modulo arithmetic
*
Multiplication
*=
Multiply and assign
^
Exponentiation
^=
Exponentiation and assignment
&
String concatenation
&=
String concatenation and assignment
=
Equality, assignment
Is
Equality (for object references)
<
Less than
<=, =<
Less than or equal to
>
Greater than
>=, =>
Greater than or equal to
<>, ><
Not equal to
And
Logical or bitwise conjunction
AndAlso
Logical conjunction with short-circuiting
Or
Logical or bitwise disjunction
OrElse
Logical disjunction with short-circuiting
Not
Logical or bitwise negation
Xor
Logical or bitwise exclusion
Expressions are evaluated in the following order:
  1. Arithmetic operators
    1. Exponentiation
    2. Division and multiplication
    3. Integer division
    4. Modulo arithmetic
    5. Addition and subtraction
  2. Concatenation operators
  3. Logical operators
    1. Not
    2. And, AndAlso
    3. Or, OrElse
    4. X
If two or more operators in an expression have the same order of precedence, they are evaluated from left to right.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Constants
VB recognizes the following intrinsic constants:
vbGet
vbMethod
vbLet
vbSet
vbBinaryCompare
vbTextCompare
vbSunday
vbSaturday
vbMonday
vbUseSystem
vbTuesday
vbUseSystemDayOfWeek
vbWednesday
vbFirstJan1
vbThursday
vbFirstFourDays
vbFriday
vbFirstFullWeek
vbGeneralDate
vbShortDate
vbLongDate
vbShortTime
vbLongTime
vbObjectError
vbArchive
vbNormal
vbDirectory
vbSystem
vbHidden
vbVolume
vbReadOnly
False
vbTrue
True
vbUseDefault
vbFalse

Section 1.7.8.1: Buttons constants

vbAbortRetryIgnore
vbRetryCancel
vbMsgBoxHelp
vbYesNo
vbOKCancel
vbYesNoCancel
vbOKOnly

Section 1.7.8.2: Default button constants

vbDefaultButton1
vbDefaultButton3
vbDefaultButton2

Section 1.7.8.3: Icon constants

vbCritical
vbInformation
vbExclamation
vbQuestion

Section 1.7.8.4: Modality constants

vbApplicationModal
vbSystemModal

Section 1.7.8.5: Return value constants

vbAbort
vbOK
vbCancel
vbRetry
vbIgnore
vbYes
vbNo

Section 1.7.8.6: Miscellaneous constants

vbMsgBoxRight
vbMsgBoxSetForeground
vbMsgBoxRtlReading
vbBack
vbNewLine
vbCr
vbNullChar
vbCrLf
vbNullString
vbFormFeed
vbTab
vbLf
vbVerticalTab
vbArray
vbInteger
vbBoolean
vbLong
vbByte
vbNull
vbCurrency
vbObject
vbDate
vbSingle
vbDecimal
vbString
vbDouble
vbUserDefinedType
vbEmpty
vbVariant
vbHide
vbNarrow
vbHiragana
vbNormalFocus
vbKatakana
vbNormalNoFocus
vbLinguisticCasing
vbProperCase
vbLowerCase
vbSimplifiedChinese
vbMaximizedFocus
vbTraditionalChinese
vbMinimizedFocus
vbUpperCase
vbMinimizedNoFocus
vbWide
User-defined constants can be declared using the Const statement.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Enumerations
The Microsoft.VisualBasic namespace also defines a number of enumerations. Many of their members are functionally identical to almost identically named constants listed in the aforementioned Section 1.7.
Determines the appearance and behavior of the window opened by the Shell function.
Hide
MinimizedNoFocus
MaximizedFocus
NormalFocus
MinimizedFocus
NormalNoFocus
Defines the type of procedure invoked by the CallByName function.
Get
Set
Method
Used with a variety of string comparison methods (such as InStr, StrComp, and Replace) to determine whether the comparison is case sensitive or insensitive.
Binary
Text
Values representing a number of control characters are available as static read-only fields of the ControlChars class. They can be referenced just as enumerated members; for example:
Addr = "123 West St. & ControlChars.CrLf & _
       "Apt. 12C"
Back
NewLine
Cr
NullChar
CrLf
Quote
FormFeed
Tab
Lf
VerticalTab
Defines the format of the date returned by the FormatDateTime function.
GeneralDate
ShortDate
LongDate
ShortTime
LongTime
Defines the date interval for date/time functions, such as DateDiff, DatePart, and DateAdd.
Day
Quarter
DayOfYear
Second
Hour
Weekday
Minute
WeekOfYear
Month
Year
Used with the FV, IPmt, NPer, Pmt, PPmt, PV, and Rate functions to define whether a payment is due at the beginning or end of a period.
BegOfPeriod
EndOfPeriod
Used with the Dir, GetAttr, and SetAttr functions to set a file's attributes or to retrieve files with particular attributes set.
Archive
ReadOnly
Directory
System
Hidden
Volume
Normal
Used with the DatePart, DateDiff, Weekday, and WeekdayName functions to define the first day of the week and to interpret the function's return value.
Friday
System
Monday
Tuesday
Saturday
Thursday
Sunday
Wednesday
Used with the DatePart and
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Object Programming
Unlike previous versions of VB, VB.NET is a fully object-oriented programming language. This object orientation has two aspects: access to the .NET Framework Class Library (FCL), and the ability to define and instantiate custom classes using inheritance.
The .NET Framework Class Library is an object-oriented library consisting of thousands of system and application types (classes, structures, interfaces, delegates, and enumerations) organized in namespaces. The namespaces and types of the .NET FCL offer a wide range of functionality, from wrappers to classic Win32 API functions to diagnostics and debugging to input/output to data access, Windows forms programming, and web application and web service development. In fact, most of the "intrinsic" functions and procedures that are part of the VB.NET language are implemented as members of classes in the Microsoft.VisualBasic namespace.
In order to access the types in a namespace, the compiler must be provided with a reference to its assembly. This is done with the /r switch using the VB command line compiler. When a type is instantiated or a type member is invoked, ordinarily the type's fully qualified namespace must be included. For example, a new instance of an ApplicationException class is generated by the following code fragment:
Dim e As New System.ApplicationException(  )
As an alternative, you can have the compiler or the Visual Studio design-time resolve an unqualified object reference by using the Imports directive to import a type's namespace. The Imports directive appears at the top of a file, after any Option statements and before any type or module definitions. Using Imports, we can instantiate an ApplicationException object as follows:
Dim e As New ApplicationException(  )
In addition to accessing the functionality of the .NET FCL, you can also define your own custom types, including custom classes. In defining a class, you can take advantage of inheritance; that is, you can indicate that your class derives from another class, either from a class in the .NET FCL or from another custom class. In this case, your class automatically inherits the functionality of its base class. You can even take advantage of inheritance without explicitly specifying an inherited class. All classes automatically inherit from type
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Program Structure
When a class or structure is instantiated, its class constructor (which in VB is a subroutine named New) is automatically invoked. In addition, each executable requires an entry point in the form of a function or subroutine named Main. For example:
Public Class PgmStruct

   Private Value As Integer

   Public Sub New(x As Integer)
      Value = x   
   End Sub

   Public Shared Sub Main(  )
      Dim obj As New PgmStruct(100)
      Console.WriteLine(obj.Value)
   End Sub
End Class
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Array Handling
Erase Statement
Erase arraylist
arraylist required; String literal
A list of array variables to clear
Description
Releases an array object. This is equivalent to setting the array variable to Nothing. More than one array can be specified by using commas to delimit arraylist.
IsArray Function
Microsoft.VisualBasic.Information
IsArray(varname)
varname required; any variable
A variable that may be an array
Return Value
Boolean (True or False)
Description
Tests whether an object variable points to an array. Note that an uninitialized array returns False.
Join Function
Microsoft.VisualBasic.Strings
result = Join(sourcearray, [delimiter])
sourcearray required; String or Object array
Array whose elements are to be concatenated
delimiter optional; String
Character used to delimit the individual values in the string
Return Value
String
Description
Concatenates an array of values into a delimited string using a specified delimiter, or, if no delimiter is specified, a space.
LBound Function
Microsoft.VisualBasic.Information
LBound(array[, rank])
array required; any array
An array whose lower bound is to be determined
rank optional; Integer
The dimension whose lower bound is desired
Return Value
An Integer whose value is 0
Description
Determines the lower boundary of a specified dimension of an array. The lower boundary is the smallest subscript you can access within the specified array.
ReDim Statement
ReDim [Preserve] varname(subscripts) _ [, varname(subscripts) ...]
Preserve optional; Keyword
Preserves the data within an array when changing the only or last dimension
varname required; String literal
Name of the variable
subscripts required; Numeric
Number of elements and dimensions of the array, using the syntax:
upper [, upper] ...
The number of upper bounds specified is the number of dimensions. Each upper bound specifies the size of the corresponding coordinate.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Collection Objects
Collection.Add Method
Microsoft.VisualBasic.Collection
objectvariable.Add item [, key, before, after]
objectvariable required; Collection Object
The Collection object to which an item is to be added
item required; Object
An object of any type that specifies the member to add to the collection
key optional; String
A unique string expression that specifies a key string that can be used, instead of a positional index, to access a member of the collection
before optional; Object
Index or key of the item after which the new item is to be added
after optional; Object
Index or key of the item before which the new item is to be added
Description
Adds an item to a particular position in a collection, or to the end of the collection if no positioned specified.
Collection.Count Property
Microsoft.VisualBasic.Collection
objectvariable.Count
objectvariable required; Collection Object
An object variable of type Collection
Description
Returns an Integer containing the number of members in the collection.
Collection.Item Method
Microsoft.VisualBasic.Collection
objectvariable.Item(index)
objectvariable required; Collection Object
An object variable of type Collection
index required; Integer or String
The index (the ordinal position) or the unique key name of the object in the collection
Description
Returns the member of the collection for the specified key or ordinal position.
Collection.Remove Method
Microsoft.VisualBasic.Collection
objectvariable.Remove(index)
objectvariable required; Collection Object
An object variable of the Collection type
index required; Integer or String
The ordinal position or the unique key name of the item to remove
Description
Removes a member from a collection.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Conditional Compilation
#Const Directive
#Const constantname = expression
constantname required; String literal
Name of the constant
expression required; literal
Any combination of literal values, other conditional compilation constants defined with the #Const directive, and arithmetic or logical operators except Is
Description
Defines a conditional compiler constant.
#If . . . Then . . . #Else Directive
#If expression Then statements [#ElseIf furtherexpression Then [elseifstatements]] [#Else [elsestatements]] #End If
expression required
An expression made up of literals, operators, and conditional compiler constants that will evaluate to True or False
statements required
One or more lines of code or compiler directives, which is executed if expression evaluates to True
furtherexpression optional
An expression made up of literals, operators, and conditional compiler constants that will evaluate to True or False. furtherexpression is only evaluated if the preceding expression evaluates to False
elseifstatements optional
One or more lines of code or compiler directives, which is executed if furtherexpression evaluates to True
elsestatements optional
One or more lines of code or compiler directives, which are executed if expression or furtherexpression evaluates to False
Description
Defines a block or blocks of code that are only included in the compiled application when a particular condition is met, allowing you to create more than one version of the application using the same source code.
Conditionally including a block of code is a two-step process:
  • Use the #Const directive to assign a value to a conditional compiler constant.
  • Evaluate the conditional compiler constant using the #If...Then...#End If statement block.
Only code blocks whose expressions evaluate to True are included in the executable. You can use the #Else statement to execute code when the #If...Then expression evaluates to False. You can also use an #ElseIf statement to evaluate more expressions if previous expressions in the same block have evaluated to
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Other Conversion
Fix Function
Microsoft.VisualBasic.Conversion
Fix(number)
number required; Double or any numeric expression
A number whose integer portion is to be returned
Return Value
A number of the same data type as number whose value is the integer portion of number
Description
For nonnegative numbers, Fix returns the floor of the number (the largest integer less than or equal to number). For negative numbers, Fix returns the ceiling of the number (the smallest integer greater than or equal to number). If number is Nothing, Fix returns Nothing.
The operation of Int and Fix are identical when dealing with positive numbers: numbers are rounded down to the next lowest whole number. For example, both Int(3.14) and Fix(3.14) return 3. If number is negative, Fix removes its fractional part, thereby returning the next greater whole number. For example, Fix(-3.667) returns -3. This contrasts with Int, which returns the negative integer less than or equal to number (or -4, in the case of our example).
Hex Function
Microsoft.VisualBasic.Conversion
Hex(number)
number required; Numeric or String
A valid numeric or string expression
Return Value
String representing the hexadecimal value of number
Description
Converts a number to its hexadecimal (base 16) equivalent. If number contains a fractional part, it will be automatically rounded to the nearest whole number before the Hex function is evaluated. number must evaluate to a numeric expression that ranges from -2,147,483,648 to 2,147,483,647. If the argument is outside of this range, an exception results. The return value of Hex is dependent upon the value and type of number:
number
Return value
Nothing
Zero (0)
Any other number
Up to eight hexadecimal characters
Int Function
Microsoft.VisualBasic.Conversion
Int(number)
number required; any valid numeric data type
The number to be processed
Return Value
Returns a value of the data type passed to it
Description
Returns the integer portion of a number. The fractional part of
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Date and Time
DateAdd Function
Microsoft.VisualBasic.DateAndTime
DateAdd(interval, number, datevalue)
interval required; String or DateInterval enum
The interval of time to add
number required; Double
An expression denoting the number of time intervals you want to add (it can be positive or negative)
datevalue required; Date, or an expression capable of conversion to a date
The starting date to which the interval is to be added
Return Value
A past or future Date that reflects the result of the addition
Description
Returns a Date representing the result of adding (or subtracting, if number is negative) a given number of time periods to or from a given date. For instance, you can calculate the date 178 months before today's date, or the date and time 12,789 minutes from now.
interval can be one of the following literal strings:
yyyy
Year
q
Quarter
m
Month
y
Day of year
d
Day
w
Weekday
ww
Week
h
Hour
n
Minute
s
Second
interval can also be a member of the DateInterval enum:
Enum DateInterval
   Day
   DayOfYear
   Hour
   Minute
   Month
   Quarter
   Second
   Week
   Weekday
   WeekOfYear
End Enum
If number is positive, the result will be in the future; if number is negative, the result will be in the past. (The meaning of "future" and "past" here is relative to datevalue.)
The DateAdd function has a built-in calendar algorithm to prevent it from returning an invalid date. You can add 10 minutes to 31 December 1999 23:55, and DateAdd automatically recalculates all elements of the date to return a valid date, in this case 1 January 2000 00:05. This includes leap years; the calendar algorithm takes the presence of 29 February into account for leap years.
DateDiff Function
Microsoft.VisualBasic.DateAndTime
DateDiff(interval, date1, date2[, dayofweek[, weekofyear]])
interval required; String or DateInterval enum
Specifies the time unit used to express the difference between date1 and date2
date1, date2 required; Date or a literal date
The starting and ending dates, whose difference is computed as
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Declaration
Class . . . End Class Statement
[accessmodifier] [Shadows] [inheritability] Class Name statements End Class
accessmodifier optional; Keyword
The possible values of accessmodifier are Public, Private, and Friend
Shadows optional; Keyword
Indicates that the Name class shadows any element of this same name in a base class
inheritability optional; Keyword
One of the keywords, MustInherit or NotInheritable, must be used. MustInherit specifies that objects of this class cannot be created, but that objects of derived classes can be created. NotInheritable specifies that this class cannot be used as a base class
Name required; String literal
The name of the class
Description
Defines a class and delimits the statements that define that class' variables, properties, and methods.
If the Inherits or Implements statements appear in a class module, they must appear before any other statements in the module. Moreover, the Inherits keyword must appear before the Implements keyword.
Within a class code block, members are declared as Public, Private, Protected, Friend, or Protected Friend. The Dim keyword is equivalent to Private when used in class modules (but it is equivalent to Public in structures). Property declarations are automatically Public.
The Class...End Class construct can include the following elements:
Private variable or procedure declarations
These items are accessible within the class but do not have scope outside of the class.
Public variable or procedure declarations
Public variables are public properties of the class; Public procedures are public methods of the class.
Property declarations
These are the public properties of the class. Default properties can be declared by using the Default keyword.
Const Statement
[accessmodifier] Const constantname [As type] = constantvalue
accessmodifier optional; Keyword
One of the keywords Public, Private, Protected, Friend, or Protected Friend.
constantname required; String Literal
The name of the constant.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Error Handling
Erl Property
Microsoft.VisualBasic.Information
Erl
Return Value
An Integer containing the line number
Description
Indicates the line number on which an error occurred.
Err.Clear Method
Microsoft.VisualBasic.ErrObject
Err.Clear( )
Description
Explicitly resets all the properties of the Err object after an error has been handled.
Err.Description Property
Microsoft.VisualBasic.ErrObject
Err.Description = string To set the property string = Err.Description To return the property value
string required; String
Any string expression
Description
A read/write property containing a short string describing a runtime error.
Err.GetException Method
Microsoft.VisualBasic.ErrObject
Err.GetException( )
Return Value
A System.Exception object or an object inherited from it containing the current exception
Description
Returns the Exception object associated with the current error.
Err.HelpContext Property
Microsoft.VisualBasic.ErrObject
Err.HelpContext
Description
A read/write property that either sets or returns an Integer value containing the context ID of the appropriate topic within a Help file.
Err.HelpFile Property
Microsoft.VisualBasic.ErrObject
Err.HelpFile
Description
A read/write String property that contains the fully qualified path of a Windows Help file.
Err.LastDLLError Property
Microsoft.VisualBasic.ErrObject
Err.LastDLLError
Description
A read-only property containing a system error code representing a system error produced within a DLL called from a VB program.
Err.Number Property
Microsoft.VisualBasic.ErrObject
Err.Number
Description
A read/write property containing a numeric value that represents the error code for the last error generated.
Err.Raise Method
Microsoft.VisualBasic.ErrObject
Err.Raise(number, source, description, helpfile, helpcontext)
number required; Long integer
A numeric identifier of the particular error
source optional; String
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Filesystem
ChDir Procedure
Microsoft.VisualBasic.FileSystem
ChDir(path)
path required; String
The path of the directory to set as the new default directory
Description
Changes the current working (default) directory.
ChDrive Procedure
Microsoft.VisualBasic.FileSystem
ChDrive(drive)
drive required; String or Char
The letter of the drive (A-Z) to set as the new default drive
Description
Changes the current working (default) disk drive.
CurDir Function
Mic