Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 56 additions & 7 deletions docs/Reference/Categories.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ Statements:

Procedures:

* [Err](../tB/Modules/Information/Err) - returns the **ErrObject** describing the current run-time error state
* [Erl](../tB/Modules/Information/Erl) - returns the line number where the most recent run-time error occurred
* [Error$, Error](../tB/Modules/Conversion/Error) function - returns the error message that corresponds to a given error number
* [CVErr](../tB/Modules/Conversion/CVErr) - wraps a numeric expression in a **Variant** of subtype **Error**

Expand All @@ -73,21 +75,33 @@ Statements:
* [Private](../tB/Core/Private) - declare a private variable in a class or module
* [Static](../tB/Core/Static) - declare a a variable of static duration

See also:

* [Erase](../tB/Core/Erase) - clear/fill an array
* [ReDim](../tB/Core/ReDim) - change the size of an array

## Variable Assignment and Modification

Statements:

- [Let](../tB/Core/Let) - sets the value of a variable
- [Set](../tB/Core/Set) - changes the object referred by the variable
- [Erase](../tB/Core/Erase) - fills a fixed-size array with default values, or invalidates a dynamic array
- [LSet](../tB/Core/LSet) - assigns a user-defined type, or left-aligns a string
- [RSet](../tB/Core/RSet) - right-aligns a string
- [ReDim](../tB/Core/ReDim) - change the size of a dynamically-sized array,

## Arrays

Statements:

* [ReDim](../tB/Core/ReDim) - allocate or change the size of a dynamically-sized array
* [Erase](../tB/Core/Erase) - fill a fixed-size array with default values, or invalidate a dynamic array

Procedures:

* [LBound](../tB/Modules/Information/LBound) - smallest valid subscript for an array dimension
* [UBound](../tB/Modules/Information/UBound) - largest valid subscript for an array dimension
* [IsArray](../tB/Modules/Information/IsArray) - returns whether a variable is an array
* [IsArrayInitialized](../tB/Modules/Information/IsArrayInitialized) - returns whether an array has been dimensioned

See also:

* [Dim](../tB/Core/Dim) - allocate a scalar or array variable
* [Array](../tB/Modules/VBA/Array), [Filter](../tB/Modules/Strings/Filter), [Join](../tB/Modules/Strings/Join), [Split](../tB/Modules/Strings/Split) - array helpers in the **VBA** and **Strings** modules

## File I/O

Expand Down Expand Up @@ -137,6 +151,16 @@ Procedures:
* [Beep](../tB/Core/Beep) - sound a system beep
* [SendKeys](../tB/Core/SendKeys) - send keystrokes to the active window

## Colours

Procedures:

* [RGB](../tB/Modules/Information/RGB) - build an RGB colour value from red, green, and blue components
* [RGBA](../tB/Modules/Information/RGBA) - build an RGBA colour value from red, green, blue, and alpha components
* [RGB_R](../tB/Modules/Information/RGB_R), [RGB_G](../tB/Modules/Information/RGB_G), [RGB_B](../tB/Modules/Information/RGB_B), [RGBA_A](../tB/Modules/Information/RGBA_A) - extract individual colour components
* [QBColor](../tB/Modules/Information/QBColor) - return the RGB colour value for a QuickBASIC colour index
* [TranslateColor](../tB/Modules/Information/TranslateColor) - translate an OLE colour value to a plain RGB colour value

## Mathematics

Procedures:
Expand Down Expand Up @@ -189,6 +213,27 @@ See also:
* [FormatNumber](../tB/Modules/Strings/FormatNumber), [FormatPercent](../tB/Modules/Strings/FormatPercent), [FormatCurrency](../tB/Modules/Strings/FormatCurrency), [FormatDateTime](../tB/Modules/Strings/FormatDateTime) - typed formatters
* [CVErr](../tB/Modules/Conversion/CVErr), [Error$, Error](../tB/Modules/Conversion/Error) function - error helpers (see [Error Handling](#error-handling))

## Type Inspection

Procedures that name or identify a variable's subtype:

* [VarType](../tB/Modules/Information/VarType) - returns the **VbVarType** code identifying a variable's subtype
* [TypeName](../tB/Modules/Information/TypeName) - returns the name of a variable's data type as a **String**

Procedures that test a value's state or subtype:

* [IsDate](../tB/Modules/Information/IsDate) - returns whether an expression can be evaluated as a date
* [IsEmpty](../tB/Modules/Information/IsEmpty) - returns whether a **Variant** is uninitialised
* [IsError](../tB/Modules/Information/IsError) - returns whether an expression is an error subtype
* [IsMissing](../tB/Modules/Information/IsMissing) - returns whether an optional argument was supplied
* [IsNull](../tB/Modules/Information/IsNull) - returns whether a variable contains a **Null** value
* [IsNumeric](../tB/Modules/Information/IsNumeric) - returns whether an expression can be evaluated as a number
* [IsObject](../tB/Modules/Information/IsObject) - returns whether a variable refers to an object

See also:

* [IsArray](../tB/Modules/Information/IsArray), [IsArrayInitialized](../tB/Modules/Information/IsArrayInitialized) - in [Arrays](#arrays)

## String Handling

Statements that modify strings:
Expand Down Expand Up @@ -266,6 +311,10 @@ Procedures:
* [ProcessorArchitecture](../tB/Modules/Compilation/ProcessorArchitecture) - returns the processor architecture of the running application
* [CompilerVersion](../tB/Modules/Compilation/CompilerVersion) - returns the twinBASIC compiler version number

See also:

* [IMEStatus](../tB/Modules/Information/IMEStatus) - the current Input Method Editor mode (East Asian Windows only)

## Financial

Procedures:
Expand Down
2 changes: 0 additions & 2 deletions docs/Reference/Core/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ redirect_from:
- /tB/Core/Interface
- /tB/Core/Is

- /tB/Core/LBound
- /tB/Core/Let
- /tB/Core/Line-Input
- /tB/Core/Load
Expand Down Expand Up @@ -49,7 +48,6 @@ redirect_from:
- /tB/Core/Sub
- /tB/Core/Stop
- /tB/Core/Type
- /tB/Core/UBound
- /tB/Core/Unload
- /tB/Core/Unlock
- /tB/Core/While-Wend
Expand Down
37 changes: 37 additions & 0 deletions docs/Reference/Modules/Information/Erl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: Erl
parent: Information Module
permalink: /tB/Modules/Information/Erl
redirect_from:
- /tB/Core/Erl
---
# Erl
{: .no_toc }

Returns a **Long** containing the line number of the most recently executed statement at which a run-time error was raised.

Syntax: **Erl** [ **()** ]

A *line number* is a numeric label that prefixes a statement, such as the `110:` in `110: x = 1 / 0`. They are a relic of older Basic dialects, retained mainly so that error handlers can report where a fault occurred. **Erl** is set to that label when an error is raised inside the labelled statement, and reset to **0** when the active error handler exits via **Resume**, **Resume Next**, or any **Exit** statement.

If the statement that raised the error has no preceding line number, **Erl** returns **0**.

### Example

This example uses **Erl** to log the line number where a run-time error was raised.

```tb
Sub Demo()
On Error GoTo Handler
100: Dim x As Double
110: x = 1 / 0 ' Generates a division-by-zero error.
Exit Sub
Handler:
Debug.Print "Error at line "; Erl ' Prints "Error at line 110".
End Sub
```

### See Also

- [Err](Err) property
- [On Error](../../Core/On-Error) statement
46 changes: 46 additions & 0 deletions docs/Reference/Modules/Information/Err.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: Err
parent: Information Module
permalink: /tB/Modules/Information/Err
redirect_from:
- /tB/Core/Err
---
# Err
{: .no_toc }

Returns or sets the [**ErrObject**](../ErrObject) describing the current run-time error state.

Syntax:
- **Err** [ **()** ]
- **Err** **=** *errorNumber*

*errorNumber*
: A **Long** error code to assign to the **Err** object. This is shorthand for `Err.Number = errorNumber`, since [**Number**](../ErrObject/Number) is the default property of **ErrObject**.

The **Err** object is intrinsic and global — there is no need to declare or construct one. Its properties are populated when a run-time error is raised, and reset to zero or zero-length strings when the active error handler exits via **Resume**, **Resume Next**, or any **Exit** statement, or when [**Err.Clear**](../ErrObject/Clear) is called explicitly.

To generate a run-time error from your own code, use the [**Raise**](../ErrObject/Raise) method rather than the **Error** statement, especially for class-module and Automation errors.

### Example

This example uses the [**Number**](../ErrObject/Number), [**Description**](../ErrObject/Description), [**HelpContext**](../ErrObject/HelpContext), [**HelpFile**](../ErrObject/HelpFile), and [**Source**](../ErrObject/Source) properties of the **Err** object to construct an error-message dialog.

```tb
Dim Msg As String
On Error Resume Next ' Defer error handling.
Err.Clear
Err.Raise 6 ' Generate an "Overflow" error.
If Err.Number <> 0 Then
Msg = "Error # " & Err.Number & " was generated by " _
& Err.Source & vbCrLf & vbCrLf & Err.Description
MsgBox Msg, vbMsgBoxHelpButton, "Error", Err.HelpFile, Err.HelpContext
End If
```

### See Also

- [ErrObject](../ErrObject) module
- [Erl](Erl) function
- [On Error](../../Core/On-Error) statement

{% include VBA-Attribution.md %}
25 changes: 25 additions & 0 deletions docs/Reference/Modules/Information/IMEStatus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: IMEStatus
parent: Information Module
permalink: /tB/Modules/Information/IMEStatus
redirect_from:
- /tB/Core/IMEStatus
---
# IMEStatus
{: .no_toc }

Returns a [**VbIMEStatus**](../Constants/VbIMEStatus) value specifying the current Input Method Editor (IME) mode of Microsoft Windows; available in East Asian versions only.

Syntax: **IMEStatus** [ **()** ]

The return value is one of the [**VbIMEStatus**](../Constants/VbIMEStatus) constants. Locales differ in which constants can be returned:

- **Japanese**: any of `vbIMEModeNoControl`, `vbIMEModeOn`, `vbIMEModeOff`, `vbIMEModeDisable`, `vbIMEModeHiragana`, `vbIMEModeKatakana`, `vbIMEModeKatakanaHalf`, `vbIMEModeAlphaFull`, `vbIMEModeAlpha`.
- **Korean**: `vbIMEModeNoControl`, `vbIMEModeAlphaFull`, `vbIMEModeAlpha`, `vbIMEModeHangulFull`, `vbIMEModeHangul`.
- **Chinese**: `vbIMEModeNoControl`, `vbIMEModeOn`, `vbIMEModeOff`.

### See Also

- [VbIMEStatus](../Constants/VbIMEStatus) enumeration

{% include VBA-Attribution.md %}
38 changes: 38 additions & 0 deletions docs/Reference/Modules/Information/IsArray.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: IsArray
parent: Information Module
permalink: /tB/Modules/Information/IsArray
redirect_from:
- /tB/Core/IsArray
---
# IsArray
{: .no_toc }

Returns a **Boolean** indicating whether a variable is an array.

Syntax: **IsArray(** *varname* **)**

*varname*
: *required* An identifier specifying the variable to test.

**IsArray** returns **True** if the variable is an array; otherwise, it returns **False**. **IsArray** is especially useful with **Variant**s containing arrays.

### Example

This example uses **IsArray** to check whether a variable is an array.

```tb
Dim MyArray(1 To 5) As Integer
Dim YourArray As Variant
Dim MyCheck As Boolean
YourArray = Array(1, 2, 3) ' Use the Array function.
MyCheck = IsArray(MyArray) ' Returns True.
MyCheck = IsArray(YourArray) ' Returns True.
```

### See Also

- [IsArrayInitialized](IsArrayInitialized) function
- [LBound](LBound), [UBound](UBound) functions

{% include VBA-Attribution.md %}
36 changes: 36 additions & 0 deletions docs/Reference/Modules/Information/IsArrayInitialized.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: IsArrayInitialized
parent: Information Module
permalink: /tB/Modules/Information/IsArrayInitialized
---
# IsArrayInitialized
{: .no_toc }

Returns a **Boolean** indicating whether a variable contains an array whose dimensions have been allocated.

Syntax: **IsArrayInitialized(** *varname* **)**

*varname*
: *required* The array variable to test.

A dynamic array declared with empty parentheses (`Dim a() As Long`) holds a special "uninitialized" state until **ReDim** allocates storage for it. **IsArrayInitialized** returns **False** in that state and **True** once the array has dimensions. Calling [**LBound**](LBound) or [**UBound**](UBound) on an uninitialized array, or accessing any of its elements, raises a run-time error — so **IsArrayInitialized** is the safe way to test before reading.

If *varname* is not an array, **IsArrayInitialized** returns **False**.

### Example

This example tests an array before and after **ReDim**, and again after **Erase** releases its storage.

```tb
Dim a() As Long
Debug.Print IsArrayInitialized(a) ' False — declared but unsized.
ReDim a(0 To 9)
Debug.Print IsArrayInitialized(a) ' True — dimensions allocated.
Erase a
Debug.Print IsArrayInitialized(a) ' False — Erase released the storage.
```

### See Also

- [IsArray](IsArray) function
- [LBound](LBound), [UBound](UBound) functions
45 changes: 45 additions & 0 deletions docs/Reference/Modules/Information/IsDate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: IsDate
parent: Information Module
permalink: /tB/Modules/Information/IsDate
redirect_from:
- /tB/Core/IsDate
---
# IsDate
{: .no_toc }

Returns **True** if the expression is a date or is recognizable as a valid date or time; otherwise, **False**.

Syntax: **IsDate(** *expression* **)**

*expression*
: *required* A **Variant** containing a date expression, or a string expression recognizable as a date or time.

The range of valid dates is January 1, 100 A.D. through December 31, 9999 A.D.

### Example

This example uses **IsDate** to determine whether an expression is recognized as a date or time value.

```tb
Dim MyVar As Variant
Dim MyCheck As Boolean
MyVar = "04/28/2014" ' Valid date.
MyCheck = IsDate(MyVar) ' True.

MyVar = "April 28, 2014" ' Valid date.
MyCheck = IsDate(MyVar) ' True.

MyVar = "13/32/2014" ' Invalid date.
MyCheck = IsDate(MyVar) ' False.

MyVar = "04.28.14" ' Valid time format on some locales.
MyCheck = IsDate(MyVar) ' True.
```

### See Also

- [CDate](../Conversion/CDate) function
- [DateValue](../DateTime/DateValue) function

{% include VBA-Attribution.md %}
40 changes: 40 additions & 0 deletions docs/Reference/Modules/Information/IsEmpty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: IsEmpty
parent: Information Module
permalink: /tB/Modules/Information/IsEmpty
redirect_from:
- /tB/Core/IsEmpty
---
# IsEmpty
{: .no_toc }

Returns a **Boolean** indicating whether a **Variant** has been initialized.

Syntax: **IsEmpty(** *expression* **)**

*expression*
: *required* A **Variant** containing a numeric or string expression. Most often, *expression* is a single variable name, since **IsEmpty** only returns meaningful information for **Variant**s.

**IsEmpty** returns **True** if the variable is uninitialized or has been explicitly set to **Empty**; otherwise, it returns **False**. **False** is always returned if *expression* contains more than one variable.

### Example

This example uses **IsEmpty** to determine whether a variable has been initialized.

```tb
Dim MyVar As Variant
Dim MyCheck As Boolean
MyCheck = IsEmpty(MyVar) ' True — uninitialised.

MyVar = Null
MyCheck = IsEmpty(MyVar) ' False — Null is not Empty.

MyVar = Empty
MyCheck = IsEmpty(MyVar) ' True.
```

### See Also

- [IsNull](IsNull), [IsMissing](IsMissing) functions

{% include VBA-Attribution.md %}
Loading
Loading