# Information module

The **Information** module groups together standalone procedures for asking questions about a value at run time --- its subtype, whether it has been initialised, whether an optional argument was supplied --- together with related utilities for querying array bounds, building **Variant** arrays, taking raw addresses, decomposing colour values, and reaching the current run-time error state.

## Inspecting a value

The `Is...` family of functions test whether an expression has a particular state or subtype, returning a **Boolean**: [**IsArray**](/tB/Modules/Information/IsArray.md), [**IsArrayInitialized**](/tB/Modules/Information/IsArrayInitialized.md), [**IsDate**](/tB/Modules/Information/IsDate.md), [**IsEmpty**](/tB/Modules/Information/IsEmpty.md), [**IsError**](/tB/Modules/Information/IsError.md), [**IsMissing**](/tB/Modules/Information/IsMissing.md), [**IsNull**](/tB/Modules/Information/IsNull.md), [**IsNumeric**](/tB/Modules/Information/IsNumeric.md), and [**IsObject**](/tB/Modules/Information/IsObject.md). For richer queries, [**VarType**](/tB/Modules/Information/VarType.md) returns the [**VbVarType**](/tB/Modules/Constants/VbVarType.md) enumeration value identifying the subtype of a **Variant**, and [**TypeName**](/tB/Modules/Information/TypeName.md) returns its name as a **String**.

```tb check_build
Dim v As Variant
v = "1/1/2000"
Debug.Print IsDate(v)        ' True
Debug.Print VarType(v)       ' 8  (vbString)
Debug.Print TypeName(v)      ' "String"
```

## Array bounds

[**LBound**](/tB/Modules/Information/LBound.md) and [**UBound**](/tB/Modules/Information/UBound.md) return the smallest and largest valid subscript for a chosen dimension of an array. With a single argument they report on the first dimension; pass an explicit *Dimension* index to query a multidimensional array.

```tb check_build check_run
Dim Grid(1 To 4, 0 To 9) As Long
Debug.Print LBound(Grid)        ' 1   -- first dimension lower bound
Debug.Print UBound(Grid)        ' 4   -- first dimension upper bound
Debug.Print LBound(Grid, 2)     ' 0   -- second dimension lower bound
Debug.Print UBound(Grid, 2)     ' 9   -- second dimension upper bound
```

## Building Variant arrays

[**Array**](/tB/Modules/Information/Array.md) creates a **Variant** array from a comma-separated list of values; the lower bound follows the source file's **Option Base** setting. As a special form, the same name doubles as a destructuring `Property Let` for unpacking an array on the right-hand side into individual variables on the left.

```tb check_build
Dim a As Variant = Array("one", "two", "three")
Dim x As Variant, y As Variant, z As Variant
Array(x, y, z) = a              ' destructuring assignment
```

## Raw pointers

Three functions return raw addresses for use with API calls or unsafe interop: [**ObjPtr**](/tB/Modules/Information/ObjPtr.md) for an object's COM identity, [**StrPtr**](/tB/Modules/Information/StrPtr.md) for the underlying buffer of a **String**, and [**VarPtr**](/tB/Modules/Information/VarPtr.md) for any variable. The result is a **LongPtr** valid only while the underlying object, string, or variable stays alive --- taking a pointer never holds a reference of its own. To read or write the memory at a known address, pair these with the [**GetMem**](/tB/Modules/HiddenModule/GetMem4.md) / [**PutMem**](/tB/Modules/HiddenModule/PutMem4.md) family from the [(Default)](/tB/Modules/HiddenModule/index.md) module.

```tb check_build check_run
Dim n As Long = &H12345678
Dim Bytes(0 To 3) As Byte
vbaCopyBytes 4, VarPtr(Bytes(0)), VarPtr(n)
Debug.Print Hex(Bytes(0))        ' 78 -- little-endian
```

## Working with colour values

[**RGB**](/tB/Modules/Information/RGB.md) and [**RGBA**](/tB/Modules/Information/RGBA.md) build a 32-bit colour value from individual red, green, blue, and (optionally) alpha components; [**RGB_R**](/tB/Modules/Information/RGB_R.md), [**RGB_G**](/tB/Modules/Information/RGB_G.md), [**RGB_B**](/tB/Modules/Information/RGB_B.md), and [**RGBA_A**](/tB/Modules/Information/RGBA_A.md) extract those components back out. [**QBColor**](/tB/Modules/Information/QBColor.md) returns the RGB value of one of the sixteen QuickBASIC colour indexes, and [**TranslateColor**](/tB/Modules/Information/TranslateColor.md) converts an OLE colour value (which may reference an entry in the system palette) into a plain RGB colour.

```tb check_build
Dim C As Long
C = RGB(255, 100, 150)
Debug.Print RGB_R(C)         ' 255
Debug.Print RGB_G(C)         ' 100
Debug.Print RGB_B(C)         ' 150
```

## Run-time error state

[**Err**](/tB/Modules/Information/Err.md) returns the [**ErrObject**](/tB/Modules/ErrObject/index.md) describing the run-time error currently in effect --- its number, description, source, and so on. [**Erl**](/tB/Modules/Information/Erl.md) returns the line number of the statement that raised the most recent error, when one was supplied as a numeric label.

## Members

- [Array](/tB/Modules/Information/Array.md) -- creates a **Variant** array from a comma-separated list of values, or destructures one when used on the left of an assignment
- [Erl](/tB/Modules/Information/Erl.md) -- returns the line number where the most recent run-time error occurred
- [Err](/tB/Modules/Information/Err.md) -- returns the [**ErrObject**](/tB/Modules/ErrObject/index.md) describing the current run-time error state
- [IMEStatus](/tB/Modules/Information/IMEStatus.md) -- returns the status of the Input Method Editor
- [IsArray](/tB/Modules/Information/IsArray.md) -- returns whether a variable is an array
- [IsArrayInitialized](/tB/Modules/Information/IsArrayInitialized.md) -- returns whether an array has been dimensioned
- [IsDate](/tB/Modules/Information/IsDate.md) -- returns whether an expression can be evaluated as a date
- [IsEmpty](/tB/Modules/Information/IsEmpty.md) -- returns whether a **Variant** is uninitialised
- [IsError](/tB/Modules/Information/IsError.md) -- returns whether an expression is an error subtype
- [IsMissing](/tB/Modules/Information/IsMissing.md) -- returns whether an optional argument was supplied
- [IsNull](/tB/Modules/Information/IsNull.md) -- returns whether a variable contains a **Null** value
- [IsNumeric](/tB/Modules/Information/IsNumeric.md) -- returns whether an expression can be evaluated as a number
- [IsObject](/tB/Modules/Information/IsObject.md) -- returns whether a variable refers to an object
- [LBound](/tB/Modules/Information/LBound.md) -- returns the smallest valid subscript for a dimension of an array
- [ObjPtr](/tB/Modules/Information/ObjPtr.md) -- returns the COM-identity address of an object
- [QBColor](/tB/Modules/Information/QBColor.md) -- returns the RGB colour value for a QuickBASIC colour index
- [RGB](/tB/Modules/Information/RGB.md) -- builds an RGB colour value from red, green, and blue components
- [RGBA](/tB/Modules/Information/RGBA.md) -- builds an RGBA colour value from red, green, blue, and alpha components
- [RGBA_A](/tB/Modules/Information/RGBA_A.md) -- returns the alpha component of an RGBA colour value
- [RGB_B](/tB/Modules/Information/RGB_B.md) -- returns the blue component of an RGB colour value
- [RGB_G](/tB/Modules/Information/RGB_G.md) -- returns the green component of an RGB colour value
- [RGB_R](/tB/Modules/Information/RGB_R.md) -- returns the red component of an RGB colour value
- [StrPtr](/tB/Modules/Information/StrPtr.md) -- returns the address of the underlying buffer of a **String**
- [TranslateColor](/tB/Modules/Information/TranslateColor.md) -- translates an OLE colour value to a plain RGB colour value
- [TypeName](/tB/Modules/Information/TypeName.md) -- returns the name of a variable's data type as a **String**
- [UBound](/tB/Modules/Information/UBound.md) -- returns the largest valid subscript for a dimension of an array
- [VarPtr](/tB/Modules/Information/VarPtr.md) -- returns the address of a variable
- [VarType](/tB/Modules/Information/VarType.md) -- returns the [**VbVarType**](/tB/Modules/Constants/VbVarType.md) enumeration value identifying a variable's subtype
