<< Click to Display Table of Contents >> Navigation: ThinBASIC Core Language > Data types and variables > Variant variables |
Variant variables
thinBasic supports VARIANT variables. You can think of a VARIANT as a kind of container, which can hold a variable of most any data type, numeric, string.
You can use a VARIANT variable like all other variables. thinBasic will take care of all needed internal data conversions.
You may determine the type of data a VARIANT variable contains with the VARIANTVT and VARIANTVT$ functions.
The following table summarizes the predefined (built-in) equates that can be used to examine a Variant:
Result |
Equate |
Meaning |
0 |
%VT_EMPTY |
0 or Empty string |
1 |
%VT_NULL |
Null string |
2 |
%VT_I2 |
Integer |
3 |
%VT_I4 |
Long-integer |
4 |
%VT_R4 |
Single |
5 |
%VT_R8 |
Double |
6 |
%VT_CY |
Currency |
7 |
%VT_DATE |
Date |
8 |
%VT_BSTR |
Dynamic string |
9 |
%VT_DISPATCH |
Interface reference |
10 |
%VT_ERROR |
Error code |
11 |
%VT_BOOL |
Boolean |
12 |
%VT_VARIANT |
Variant |
13 |
%VT_UNKNOWN |
|
16 |
%VT_I1 |
Byte |
17 |
%VT_UI1 |
Byte |
18 |
%VT_UI2 |
Word |
19 |
%VT_UI4 |
DWORD |
20 |
%VT_I8 |
Quad (signed) |
21 |
%VT_UI8 |
Quad (unsigned) |
22 |
%VT_INT |
Integer |
23 |
%VT_UINT |
Word |
24 |
%VT_VOID |
|
25 |
%VT_HRESULT |
COM result code |
26 |
%VT_PTR |
Pointer |
27 |
%VT_SAFEARRAY |
VB Array |
28 |
%VT_CARRAY |
|
29 |
%VT_USERDEFINED |
|
30 |
%VT_LPSTR |
ANSI string |
31 |
%VT_LPWSTR |
Unicode string |
64 |
%VT_FILETIME |
|
65 |
%VT_BLOB |
|
66 |
%VT_STREAM |
|
67 |
%VT_STORAGE |
|
68 |
%VT_STREAMED_OBJECT |
|
69 |
%VT_STORED_OBJECT |
|
70 |
%VT_BLOB_OBJECT |
|
71 |
%VT_CF |
|
72 |
%VT_CLSID |
Class ID |
&H1000 |
%VT_VECTOR |
|
&H2000 |
%VT_ARRAY |
Array |
&H4000 |
%VT_BYREF |
Internally, a VARIANT is always 16-bytes in size, and may be passed as either a BYVAL or a BYREF parameter to functions.