DVX_GUI/docs/dvxbasic_language_reference.html

1084 lines
44 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Data Types</title>
<style>
body { font-family: sans-serif; margin: 0; padding: 0; display: flex; }
nav { width: 250px; min-width: 250px; background: #f0f0f0; padding: 16px;
border-right: 1px solid #ccc; height: 100vh; overflow-y: auto;
position: sticky; top: 0; box-sizing: border-box; }
nav ul { list-style: none; padding-left: 16px; margin: 4px 0; }
nav > ul { padding-left: 0; }
nav a { text-decoration: none; color: #0066cc; }
nav a:hover { text-decoration: underline; }
main { flex: 1; padding: 24px 32px; max-width: 800px; }
h1 { border-bottom: 2px solid #333; padding-bottom: 4px; }
h2 { border-bottom: 1px solid #999; padding-bottom: 2px; margin-top: 32px; }
h3 { margin-top: 24px; }
pre { background: #f8f8f8; border: 1px solid #ddd; padding: 8px;
overflow-x: auto; font-size: 14px; }
blockquote { background: #fffde7; border-left: 4px solid #ffc107;
padding: 8px 12px; margin: 12px 0; }
hr { border: none; border-top: 1px solid #ccc; margin: 24px 0; }
img { max-width: 100%; }
.topic { margin-bottom: 48px; }
</style>
</head>
<body>
<nav>
<h3>Contents</h3>
<ul>
<li><a href="#lang.datatypes">Data Types</a></li>
<li><a href="#lang.operators">Operators</a></li>
<li><a href="#lang.statements">Statements</a>
<ul>
<li><a href="#lang.declarations">Declarations</a></li>
<li><a href="#lang.conditionals">Conditionals</a></li>
<li><a href="#lang.loops">Loops</a></li>
<li><a href="#lang.procedures">Procedures</a></li>
<li><a href="#lang.flow">Flow Control</a></li>
<li><a href="#lang.io">Input/Output</a></li>
<li><a href="#lang.misc">Miscellaneous Statements</a></li>
</ul>
</li>
<li><a href="#lang.fileio">File I/O</a></li>
<li><a href="#lang.func.string">Built-in Functions</a>
<ul>
<li><a href="#lang.func.string">String Functions</a></li>
<li><a href="#lang.func.math">Math Functions</a></li>
<li><a href="#lang.func.conversion">Conversion Functions</a></li>
<li><a href="#lang.func.fileio">File I/O Functions</a></li>
<li><a href="#lang.func.misc">Miscellaneous Functions</a></li>
</ul>
</li>
<li><a href="#lang.forms">Form and Control Statements</a></li>
<li><a href="#lang.sql">SQL Functions</a></li>
<li><a href="#lang.app">App Object</a></li>
<li><a href="#lang.ini">INI Functions</a></li>
<li><a href="#lang.constants">Predefined Constants</a></li>
</ul>
<h3>Index</h3>
<ul>
<li><a href="#lang.datatypes">Data Types</a></li>
<li><a href="#lang.datatypes">Integer</a></li>
<li><a href="#lang.datatypes">Long</a></li>
<li><a href="#lang.datatypes">Single</a></li>
<li><a href="#lang.datatypes">Double</a></li>
<li><a href="#lang.datatypes">String</a></li>
<li><a href="#lang.datatypes">Boolean</a></li>
<li><a href="#lang.operators">Operators</a></li>
<li><a href="#lang.operators">Precedence</a></li>
<li><a href="#lang.operators">AND</a></li>
<li><a href="#lang.operators">OR</a></li>
<li><a href="#lang.operators">NOT</a></li>
<li><a href="#lang.operators">XOR</a></li>
<li><a href="#lang.operators">EQV</a></li>
<li><a href="#lang.operators">IMP</a></li>
<li><a href="#lang.operators">MOD</a></li>
<li><a href="#lang.statements">Statements</a></li>
<li><a href="#lang.statements">REM</a></li>
<li><a href="#lang.statements">Comments</a></li>
<li><a href="#lang.declarations">DIM</a></li>
<li><a href="#lang.declarations">REDIM</a></li>
<li><a href="#lang.declarations">CONST</a></li>
<li><a href="#lang.declarations">TYPE</a></li>
<li><a href="#lang.declarations">END TYPE</a></li>
<li><a href="#lang.declarations">DECLARE</a></li>
<li><a href="#lang.declarations">DECLARE LIBRARY</a></li>
<li><a href="#lang.declarations">SHARED</a></li>
<li><a href="#lang.declarations">STATIC</a></li>
<li><a href="#lang.declarations">OPTION</a></li>
<li><a href="#lang.declarations">OPTION BASE</a></li>
<li><a href="#lang.declarations">OPTION COMPARE</a></li>
<li><a href="#lang.declarations">OPTION EXPLICIT</a></li>
<li><a href="#lang.declarations">DEFINT</a></li>
<li><a href="#lang.declarations">DEFLNG</a></li>
<li><a href="#lang.declarations">DEFSNG</a></li>
<li><a href="#lang.declarations">DEFDBL</a></li>
<li><a href="#lang.declarations">DEFSTR</a></li>
<li><a href="#lang.declarations">LET</a></li>
<li><a href="#lang.declarations">SWAP</a></li>
<li><a href="#lang.declarations">ERASE</a></li>
<li><a href="#lang.conditionals">IF</a></li>
<li><a href="#lang.conditionals">THEN</a></li>
<li><a href="#lang.conditionals">ELSE</a></li>
<li><a href="#lang.conditionals">ELSEIF</a></li>
<li><a href="#lang.conditionals">END IF</a></li>
<li><a href="#lang.conditionals">SELECT CASE</a></li>
<li><a href="#lang.conditionals">CASE</a></li>
<li><a href="#lang.conditionals">CASE ELSE</a></li>
<li><a href="#lang.conditionals">END SELECT</a></li>
<li><a href="#lang.loops">FOR</a></li>
<li><a href="#lang.loops">NEXT</a></li>
<li><a href="#lang.loops">STEP</a></li>
<li><a href="#lang.loops">DO</a></li>
<li><a href="#lang.loops">LOOP</a></li>
<li><a href="#lang.loops">WHILE</a></li>
<li><a href="#lang.loops">WEND</a></li>
<li><a href="#lang.loops">UNTIL</a></li>
<li><a href="#lang.loops">EXIT FOR</a></li>
<li><a href="#lang.loops">EXIT DO</a></li>
<li><a href="#lang.procedures">SUB</a></li>
<li><a href="#lang.procedures">END SUB</a></li>
<li><a href="#lang.procedures">FUNCTION</a></li>
<li><a href="#lang.procedures">END FUNCTION</a></li>
<li><a href="#lang.procedures">DEF FN</a></li>
<li><a href="#lang.procedures">BYVAL</a></li>
<li><a href="#lang.procedures">BYREF</a></li>
<li><a href="#lang.procedures">EXIT SUB</a></li>
<li><a href="#lang.procedures">EXIT FUNCTION</a></li>
<li><a href="#lang.flow">EXIT</a></li>
<li><a href="#lang.flow">CALL</a></li>
<li><a href="#lang.flow">GOTO</a></li>
<li><a href="#lang.flow">GOSUB</a></li>
<li><a href="#lang.flow">RETURN</a></li>
<li><a href="#lang.flow">ON GOTO</a></li>
<li><a href="#lang.flow">ON GOSUB</a></li>
<li><a href="#lang.io">PRINT</a></li>
<li><a href="#lang.io">INPUT</a></li>
<li><a href="#lang.io">DATA</a></li>
<li><a href="#lang.io">READ</a></li>
<li><a href="#lang.io">RESTORE</a></li>
<li><a href="#lang.io">SPC</a></li>
<li><a href="#lang.io">TAB</a></li>
<li><a href="#lang.io">PRINT USING</a></li>
<li><a href="#lang.misc">ON ERROR</a></li>
<li><a href="#lang.misc">RESUME</a></li>
<li><a href="#lang.misc">RESUME NEXT</a></li>
<li><a href="#lang.misc">ERROR</a></li>
<li><a href="#lang.misc">ERR</a></li>
<li><a href="#lang.misc">SHELL</a></li>
<li><a href="#lang.misc">SLEEP</a></li>
<li><a href="#lang.misc">RANDOMIZE</a></li>
<li><a href="#lang.misc">END</a></li>
<li><a href="#lang.misc">RANDOMIZE TIMER</a></li>
<li><a href="#lang.fileio">OPEN</a></li>
<li><a href="#lang.fileio">CLOSE</a></li>
<li><a href="#lang.fileio">PRINT #</a></li>
<li><a href="#lang.fileio">INPUT #</a></li>
<li><a href="#lang.fileio">LINE INPUT</a></li>
<li><a href="#lang.fileio">WRITE #</a></li>
<li><a href="#lang.fileio">GET</a></li>
<li><a href="#lang.fileio">PUT</a></li>
<li><a href="#lang.fileio">SEEK</a></li>
<li><a href="#lang.fileio">FOR INPUT</a></li>
<li><a href="#lang.fileio">FOR OUTPUT</a></li>
<li><a href="#lang.fileio">FOR APPEND</a></li>
<li><a href="#lang.fileio">FOR RANDOM</a></li>
<li><a href="#lang.fileio">FOR BINARY</a></li>
<li><a href="#lang.func.string">ASC</a></li>
<li><a href="#lang.func.string">CHR$</a></li>
<li><a href="#lang.func.string">FORMAT$</a></li>
<li><a href="#lang.func.string">HEX$</a></li>
<li><a href="#lang.func.string">INSTR</a></li>
<li><a href="#lang.func.string">LCASE$</a></li>
<li><a href="#lang.func.string">LEFT$</a></li>
<li><a href="#lang.func.string">LEN</a></li>
<li><a href="#lang.func.string">LTRIM$</a></li>
<li><a href="#lang.func.string">MID$</a></li>
<li><a href="#lang.func.string">RIGHT$</a></li>
<li><a href="#lang.func.string">RTRIM$</a></li>
<li><a href="#lang.func.string">SPACE$</a></li>
<li><a href="#lang.func.string">STR$</a></li>
<li><a href="#lang.func.string">STRING$</a></li>
<li><a href="#lang.func.string">TRIM$</a></li>
<li><a href="#lang.func.string">UCASE$</a></li>
<li><a href="#lang.func.string">VAL</a></li>
<li><a href="#lang.func.math">ABS</a></li>
<li><a href="#lang.func.math">ATN</a></li>
<li><a href="#lang.func.math">COS</a></li>
<li><a href="#lang.func.math">EXP</a></li>
<li><a href="#lang.func.math">FIX</a></li>
<li><a href="#lang.func.math">INT</a></li>
<li><a href="#lang.func.math">LOG</a></li>
<li><a href="#lang.func.math">RND</a></li>
<li><a href="#lang.func.math">SGN</a></li>
<li><a href="#lang.func.math">SIN</a></li>
<li><a href="#lang.func.math">SQR</a></li>
<li><a href="#lang.func.math">TAN</a></li>
<li><a href="#lang.func.math">TIMER</a></li>
<li><a href="#lang.func.conversion">CDBL</a></li>
<li><a href="#lang.func.conversion">CINT</a></li>
<li><a href="#lang.func.conversion">CLNG</a></li>
<li><a href="#lang.func.conversion">CSNG</a></li>
<li><a href="#lang.func.conversion">CSTR</a></li>
<li><a href="#lang.func.fileio">EOF</a></li>
<li><a href="#lang.func.fileio">FREEFILE</a></li>
<li><a href="#lang.func.fileio">INPUT$</a></li>
<li><a href="#lang.func.fileio">LOC</a></li>
<li><a href="#lang.func.fileio">LOF</a></li>
<li><a href="#lang.func.fileio">LBOUND</a></li>
<li><a href="#lang.func.fileio">UBOUND</a></li>
<li><a href="#lang.func.misc">DATE$</a></li>
<li><a href="#lang.func.misc">TIME$</a></li>
<li><a href="#lang.func.misc">ENVIRON$</a></li>
<li><a href="#lang.forms">LOAD</a></li>
<li><a href="#lang.forms">UNLOAD</a></li>
<li><a href="#lang.forms">Show</a></li>
<li><a href="#lang.forms">Hide</a></li>
<li><a href="#lang.forms">Me</a></li>
<li><a href="#lang.forms">DoEvents</a></li>
<li><a href="#lang.forms">DOEVENTS</a></li>
<li><a href="#lang.forms">MsgBox</a></li>
<li><a href="#lang.forms">MSGBOX</a></li>
<li><a href="#lang.forms">InputBox$</a></li>
<li><a href="#lang.forms">INPUTBOX$</a></li>
<li><a href="#lang.forms">vbModal</a></li>
<li><a href="#lang.forms">Control Arrays</a></li>
<li><a href="#lang.forms">Event Handlers</a></li>
<li><a href="#lang.sql">SQLOpen</a></li>
<li><a href="#lang.sql">SQLClose</a></li>
<li><a href="#lang.sql">SQLExec</a></li>
<li><a href="#lang.sql">SQLAffected</a></li>
<li><a href="#lang.sql">SQLQuery</a></li>
<li><a href="#lang.sql">SQLNext</a></li>
<li><a href="#lang.sql">SQLEof</a></li>
<li><a href="#lang.sql">SQLField$</a></li>
<li><a href="#lang.sql">SQLFieldInt</a></li>
<li><a href="#lang.sql">SQLFieldDbl</a></li>
<li><a href="#lang.sql">SQLFieldCount</a></li>
<li><a href="#lang.sql">SQLFreeResult</a></li>
<li><a href="#lang.sql">SQLError$</a></li>
<li><a href="#lang.sql">SQLite</a></li>
<li><a href="#lang.app">App</a></li>
<li><a href="#lang.app">App.Path</a></li>
<li><a href="#lang.app">App.Config</a></li>
<li><a href="#lang.app">App.Data</a></li>
<li><a href="#lang.ini">IniRead</a></li>
<li><a href="#lang.ini">IniWrite</a></li>
<li><a href="#lang.ini">INI</a></li>
<li><a href="#lang.constants">vbOKOnly</a></li>
<li><a href="#lang.constants">vbOKCancel</a></li>
<li><a href="#lang.constants">vbYesNo</a></li>
<li><a href="#lang.constants">vbYesNoCancel</a></li>
<li><a href="#lang.constants">vbRetryCancel</a></li>
<li><a href="#lang.constants">vbInformation</a></li>
<li><a href="#lang.constants">vbExclamation</a></li>
<li><a href="#lang.constants">vbCritical</a></li>
<li><a href="#lang.constants">vbQuestion</a></li>
<li><a href="#lang.constants">vbOK</a></li>
<li><a href="#lang.constants">vbCancel</a></li>
<li><a href="#lang.constants">vbYes</a></li>
<li><a href="#lang.constants">vbNo</a></li>
<li><a href="#lang.constants">vbRetry</a></li>
<li><a href="#lang.constants">True</a></li>
<li><a href="#lang.constants">False</a></li>
<li><a href="#lang.constants">Predefined Constants</a></li>
</ul>
</nav>
<main>
<div class="topic" id="lang.datatypes">
<h1>Data Types</h1>
<h2>Data Types</h2>
<p>DVX BASIC supports the following data types. Each type has a corresponding
type suffix character that can be appended to variable names.</p>
<h3>Primary Types</h3>
<pre> Type Size Suffix Range / Description
---- ---- ------ -------------------
Integer 2 bytes % -32768 to 32767
Long 4 bytes &amp; -2147483648 to 2147483647
Single 4 bytes ! 32-bit float, approximately 7 digits precision
Double 8 bytes # 64-bit float, approximately 15 digits precision
String variable $ Variable-length, reference-counted, dynamic string
Boolean 2 bytes (none) True (-1) or False (0)</pre>
<h3>Internal Types</h3>
<p>These types are not directly declarable but are used internally by the
runtime.</p>
<pre> Internal Type Description
------------- -----------
Array Reference-counted multi-dimensional array (up to 8 dimensions)
UDT User-defined type instance (created with TYPE...END TYPE)
Object Opaque host object (form reference, control reference)
Ref ByRef pointer to a variable slot (used for ByRef parameters)</pre>
<h3>Type Suffixes</h3>
<p>Type suffixes can be appended to variable names to declare their type
implicitly:</p>
<pre><code>count% = 42 ' Integer
total&amp; = 100000 ' Long
rate! = 3.14 ' Single
pi# = 3.14159265 ' Double
name$ = &quot;Hello&quot; ' String</code></pre>
<h3>Numeric Literals</h3>
<pre> Form Example Description
---- ------- -----------
Decimal integer 42 Values -32768..32767 are Integer; larger are Long
Hex integer &amp;HFF Hexadecimal literal
Long suffix 42&amp;, &amp;HFF&amp; Force Long type
Floating-point 3.14, 1.5E10 Double by default
Single suffix 3.14! Force Single type
Double suffix 3.14# Force Double type</pre>
<h3>Type Promotion</h3>
<p>When mixing types in expressions, values are automatically promoted to a
common type: Integer -&gt; Long -&gt; Single -&gt; Double. Strings are not
automatically converted to numbers (use VAL and STR$).</p>
<p><a href="#lang.func.conversion">See also: Conversion Functions</a></p>
</div>
<div class="topic" id="lang.operators">
<h1>Operators</h1>
<h2>Operators</h2>
<p>Operators listed from highest precedence (evaluated first) to lowest
precedence (evaluated last).</p>
<pre> Precedence Operator Description
---------- -------- -----------
1 (highest) ^ Exponentiation
2 - (unary) Negation
3 * / \ MOD Multiply, float div, integer div, modulus
4 + - Addition, subtraction
5 &amp; String concatenation
6 = &lt;&gt; &lt; &gt; &lt;= &gt;= Comparison (returns Boolean)
7 NOT Logical/bitwise NOT
8 AND Logical/bitwise AND
9 XOR Logical/bitwise XOR
10 OR Logical/bitwise OR
11 EQV Logical/bitwise equivalence
12 (lowest) IMP Logical/bitwise implication</pre>
<h3>String Concatenation</h3>
<p>Use &amp; to concatenate strings. The + operator also concatenates when both
operands are strings.</p>
<pre><code>result$ = &quot;Hello&quot; &amp; &quot; &quot; &amp; &quot;World&quot;
result$ = firstName$ &amp; &quot; &quot; &amp; lastName$</code></pre>
</div>
<div class="topic" id="lang.statements">
<h1>Statements Overview</h1>
<h2>Statements</h2>
<p>Multiple statements can appear on one line separated by :. Lines can be
continued with _ at the end. Comments start with ' or REM.</p>
<p><a href="#lang.declarations">Declaration Statements (DIM, REDIM, CONST, TYPE)</a></p>
<p><a href="#lang.conditionals">Conditional Statements (IF, SELECT CASE)</a></p>
<p><a href="#lang.loops">Loop Statements (FOR, DO, WHILE)</a></p>
<p><a href="#lang.procedures">Procedures (SUB, FUNCTION, DEF FN)</a></p>
<p><a href="#lang.flow">Flow Control (EXIT, CALL, GOTO, GOSUB, ON)</a></p>
<p><a href="#lang.io">Input/Output (PRINT, INPUT, DATA/READ)</a></p>
<p><a href="#lang.misc">Miscellaneous Statements</a></p>
</div>
<div class="topic" id="lang.declarations">
<h1>Declaration Statements</h1>
<h2>Declaration Statements</h2>
<h3>DIM</h3>
<p>Declares variables and arrays with an explicit type.</p>
<pre><code>DIM variable AS type
DIM variable(upperBound) AS type
DIM variable(lower TO upper) AS type
DIM variable(dim1, dim2, ...) AS type
DIM variable AS UdtName
DIM variable AS STRING * n
DIM SHARED variable AS type</code></pre>
<p>Examples:</p>
<pre><code>Dim name As String
Dim count As Integer
Dim values(100) As Double
Dim matrix(1 To 10, 1 To 10) As Single
Dim Shared globalFlag As Boolean
Dim record As PersonType
Dim fixedStr As String * 20</code></pre>
<blockquote><strong>Note:</strong> DIM SHARED makes a variable accessible from all procedures without passing
it as a parameter.</blockquote>
<h3>REDIM</h3>
<p>Reallocates a dynamic array, optionally preserving existing data.</p>
<pre><code>REDIM array(newBounds) AS type
REDIM PRESERVE array(newBounds) AS type</code></pre>
<pre><code>ReDim items(newSize) As String
ReDim Preserve scores(1 To newCount) As Integer</code></pre>
<h3>CONST</h3>
<p>Declares a named constant. The value must be a literal (integer, float,
string, or boolean).</p>
<pre><code>CONST name = value</code></pre>
<pre><code>Const MAX_SIZE = 100
Const PI = 3.14159265
Const APP_NAME = &quot;DVX App&quot;
Const DEBUG_MODE = True</code></pre>
<h3>TYPE...END TYPE</h3>
<p>Defines a user-defined type (record/structure).</p>
<pre><code>TYPE TypeName
fieldName AS type
...
END TYPE</code></pre>
<pre><code>Type PersonType
firstName As String
lastName As String
age As Integer
End Type
Dim p As PersonType
p.firstName = &quot;Scott&quot;
p.age = 30</code></pre>
<p>UDT fields can themselves be UDTs (nested types).</p>
<h3>DECLARE</h3>
<p>Forward-declares a SUB or FUNCTION. Required when a procedure is called
before it is defined.</p>
<pre><code>DECLARE SUB name ([BYVAL] param AS type, ...)
DECLARE FUNCTION name ([BYVAL] param AS type, ...) AS returnType</code></pre>
<h3>DECLARE LIBRARY</h3>
<p>Declares external native functions from a dynamically loaded library. This
allows BASIC programs to call functions exported by DXE libraries.</p>
<pre><code>DECLARE LIBRARY &quot;libraryName&quot;
DECLARE SUB name ([BYVAL] param AS type, ...)
DECLARE FUNCTION name ([BYVAL] param AS type, ...) AS returnType
END DECLARE</code></pre>
<pre><code>Declare Library &quot;rs232&quot;
Declare Function ComOpen(ByVal port As Integer) As Integer
Declare Sub ComClose(ByVal port As Integer)
Declare Sub ComSend(ByVal port As Integer, ByVal data$ As String)
End Declare</code></pre>
<h3>STATIC</h3>
<p>Declares a local variable that retains its value between calls.</p>
<pre><code>STATIC variable AS type</code></pre>
<pre><code>Sub Counter()
Static count As Integer
count = count + 1
Print count
End Sub</code></pre>
<h3>OPTION</h3>
<p>Sets compiler options. Must appear before any executable code.</p>
<pre><code>OPTION BASE 0 ' Arrays start at index 0 (default)
OPTION BASE 1 ' Arrays start at index 1
OPTION COMPARE BINARY ' Case-sensitive string comparisons (default)
OPTION COMPARE TEXT ' Case-insensitive string comparisons
OPTION EXPLICIT ' All variables must be declared with DIM</code></pre>
<h3>DEFtype Statements</h3>
<p>Set the default type for variables based on their first letter.</p>
<pre><code>DEFINT letterRange
DEFLNG letterRange
DEFSNG letterRange
DEFDBL letterRange
DEFSTR letterRange</code></pre>
<pre><code>DefInt I-N ' Variables starting with I through N default to Integer
DefStr S ' Variables starting with S default to String</code></pre>
<h3>Assignment</h3>
<p>Assigns a value to a variable, array element, or UDT field.</p>
<pre><code>variable = expression
array(index) = expression
udt.field = expression
LET variable = expression</code></pre>
<p>The LET keyword is optional and supported for compatibility.</p>
<h3>SWAP</h3>
<p>Exchanges the values of two variables.</p>
<pre><code>SWAP variable1, variable2</code></pre>
<pre><code>Swap a, b</code></pre>
<h3>ERASE</h3>
<p>Frees the memory of an array and resets it.</p>
<pre><code>ERASE arrayName</code></pre>
</div>
<div class="topic" id="lang.conditionals">
<h1>Conditional Statements</h1>
<h2>Conditional Statements</h2>
<h3>IF...THEN...ELSE...END IF</h3>
<p>Conditional execution. Supports single-line and multi-line forms.</p>
<h4>Single-line form</h4>
<pre><code>IF condition THEN statement
IF condition THEN statement ELSE statement</code></pre>
<h4>Multi-line form</h4>
<pre><code>IF condition THEN
statements
ELSEIF condition THEN
statements
ELSE
statements
END IF</code></pre>
<pre><code>If x &gt; 10 Then
Print &quot;Large&quot;
ElseIf x &gt; 5 Then
Print &quot;Medium&quot;
Else
Print &quot;Small&quot;
End If
If ready Then Print &quot;Go!&quot;</code></pre>
<h3>SELECT CASE</h3>
<p>Multi-way branch based on an expression value.</p>
<pre><code>SELECT CASE expression
CASE value
statements
CASE value1, value2
statements
CASE low TO high
statements
CASE IS operator value
statements
CASE ELSE
statements
END SELECT</code></pre>
<pre><code>Select Case grade
Case 90 To 100
Print &quot;A&quot;
Case 80 To 89
Print &quot;B&quot;
Case Is &gt;= 70
Print &quot;C&quot;
Case 60, 65
Print &quot;D (borderline)&quot;
Case Else
Print &quot;F&quot;
End Select</code></pre>
<p>CASE items can be combined with commas. The IS keyword allows comparison
operators: &lt;, &gt;, &lt;=, &gt;=, =, &lt;&gt;.</p>
</div>
<div class="topic" id="lang.loops">
<h1>Loop Statements</h1>
<h2>Loop Statements</h2>
<h3>FOR...NEXT</h3>
<p>Counted loop with an optional step value.</p>
<pre><code>FOR variable = start TO limit [STEP step]
statements
NEXT [variable]</code></pre>
<pre><code>For i = 1 To 10
Print i
Next i
For x = 10 To 0 Step -2
Print x
Next</code></pre>
<p>The variable name after NEXT is optional. Use EXIT FOR to break out early.</p>
<h3>DO...LOOP</h3>
<p>General-purpose loop with pre-test, post-test, or infinite forms.</p>
<pre><code>DO [WHILE condition | UNTIL condition]
statements
LOOP [WHILE condition | UNTIL condition]</code></pre>
<pre><code>' Pre-test
Do While count &lt; 10
count = count + 1
Loop
' Post-test
Do
line$ = ReadLine()
Loop Until line$ = &quot;quit&quot;
' Infinite loop (exit with EXIT DO)
Do
DoEvents
If done Then Exit Do
Loop</code></pre>
<h3>WHILE...WEND</h3>
<p>Simple pre-test loop (legacy form; prefer DO...LOOP).</p>
<pre><code>WHILE condition
statements
WEND</code></pre>
<pre><code>While Not EOF(1)
Line Input #1, line$
Print line$
Wend</code></pre>
</div>
<div class="topic" id="lang.procedures">
<h1>Procedures</h1>
<h2>Procedures</h2>
<h3>SUB...END SUB</h3>
<p>Defines a subroutine (no return value).</p>
<pre><code>SUB name ([BYVAL] param AS type, ...)
statements
END SUB</code></pre>
<pre><code>Sub Greet(ByVal name As String)
Print &quot;Hello, &quot; &amp; name
End Sub</code></pre>
<p>Parameters are passed ByRef by default. Use ByVal for value semantics. Use
EXIT SUB to return early.</p>
<h3>FUNCTION...END FUNCTION</h3>
<p>Defines a function with a return value.</p>
<pre><code>FUNCTION name ([BYVAL] param AS type, ...) AS returnType
statements
name = returnValue
END FUNCTION</code></pre>
<pre><code>Function Square(ByVal n As Double) As Double
Square = n * n
End Function</code></pre>
<p>Assign to the function name to set the return value. Use EXIT FUNCTION to
return early.</p>
<h3>DEF FN</h3>
<p>Defines a single-expression function.</p>
<pre><code>DEF FNname(params) = expression</code></pre>
<pre><code>Def FnSquare(x) = x * x
Print FnSquare(5) ' prints 25</code></pre>
</div>
<div class="topic" id="lang.flow">
<h1>Flow Control</h1>
<h2>Flow Control</h2>
<h3>EXIT</h3>
<p>Exits the current block early.</p>
<pre><code>EXIT FOR
EXIT DO
EXIT SUB
EXIT FUNCTION</code></pre>
<h3>CALL</h3>
<p>Explicitly calls a subroutine or function. The return value (if any) is
discarded.</p>
<pre><code>CALL name
CALL name(args)</code></pre>
<p>Normally you can omit CALL and just use the name directly.</p>
<h3>GOTO / GOSUB / RETURN</h3>
<pre><code>GOTO label
GOSUB label
RETURN</code></pre>
<p>GOSUB pushes the return address, executes code at the label, and RETURN
jumps back. At module level, RETURN returns from a GOSUB. Inside a
SUB/FUNCTION, RETURN returns from the procedure.</p>
<pre><code>GoSub Initialize
Print &quot;Done&quot;
End
Initialize:
count = 0
name$ = &quot;&quot;
Return</code></pre>
<h3>ON...GOTO / ON...GOSUB</h3>
<p>Computed branch based on an integer expression.</p>
<pre><code>ON expression GOTO label1, label2, ...
ON expression GOSUB label1, label2, ...</code></pre>
<p>If the expression evaluates to 1, control goes to the first label; 2, the
second; and so on. If out of range, execution falls through.</p>
</div>
<div class="topic" id="lang.io">
<h1>Input/Output Statements</h1>
<h2>Input/Output Statements</h2>
<h3>PRINT</h3>
<p>Outputs text to the console or to a file channel.</p>
<pre><code>PRINT [expression] [{; | ,} expression] ...
PRINT #channel, expression
PRINT USING format$; expression [; expression] ...</code></pre>
<ul>
<li>; between items -- no separator (items are concatenated)</li>
<li>, between items -- advance to the next 14-column tab zone</li>
<li>Trailing ; or , suppresses the newline</li>
</ul>
<p>? is an alias for PRINT</p>
<p>Special functions inside PRINT:</p>
<ul>
<li>SPC(n) -- print n spaces</li>
</ul>
<p>TAB(n) -- advance to column n</p>
<pre><code>Print &quot;Name:&quot;; Tab(20); name$
Print Using &quot;###.##&quot;; total
Print #1, &quot;Written to file&quot;</code></pre>
<h3>INPUT</h3>
<p>Reads a line of text from the user or from a file channel.</p>
<pre><code>INPUT variable
INPUT &quot;prompt&quot;; variable
INPUT #channel, variable</code></pre>
<pre><code>Input &quot;Enter your name: &quot;; name$
Input #1, line$</code></pre>
<h3>DATA / READ / RESTORE</h3>
<p>Inline data pool for constants.</p>
<pre><code>DATA value1, value2, &quot;string&quot;, ...
READ variable1, variable2, ...
RESTORE</code></pre>
<p>DATA statements define a pool of values. READ reads the next value from the
pool into a variable. RESTORE resets the read pointer to the beginning.</p>
<pre><code>Data 10, 20, 30, &quot;Hello&quot;
Read a, b, c, msg$
Print a; b; c; msg$
Restore</code></pre>
</div>
<div class="topic" id="lang.misc">
<h1>Miscellaneous Statements</h1>
<h2>Miscellaneous Statements</h2>
<h3>Error Handling</h3>
<pre><code>ON ERROR GOTO label ' Enable error handler
ON ERROR GOTO 0 ' Disable error handler
RESUME ' Retry the statement that caused the error
RESUME NEXT ' Continue at the next statement after the error
ERROR n ' Raise a runtime error with error number n</code></pre>
<p>The ERR keyword returns the current error number in expressions.</p>
<pre><code>On Error GoTo ErrorHandler
Open &quot;missing.txt&quot; For Input As #1
Exit Sub
ErrorHandler:
Print &quot;Error number:&quot;; Err
Resume Next</code></pre>
<h3>SHELL</h3>
<p>Executes an operating system command.</p>
<pre><code>SHELL &quot;command&quot;</code></pre>
<p>When used as a function, returns the exit code of the command.</p>
<pre><code>Shell &quot;DIR /B&quot;
exitCode = Shell(&quot;COPY A.TXT B.TXT&quot;)</code></pre>
<h3>SLEEP</h3>
<p>Pauses execution for a specified number of seconds.</p>
<pre><code>SLEEP seconds</code></pre>
<h3>RANDOMIZE</h3>
<p>Seeds the random number generator.</p>
<pre><code>RANDOMIZE seed
RANDOMIZE TIMER ' Seed from system clock</code></pre>
<h3>END</h3>
<p>Terminates program execution immediately.</p>
<pre><code>END</code></pre>
</div>
<div class="topic" id="lang.fileio">
<h1>File I/O</h1>
<h2>File I/O</h2>
<h3>OPEN</h3>
<p>Opens a file for reading, writing, or appending.</p>
<pre><code>OPEN filename$ FOR INPUT AS #channel
OPEN filename$ FOR OUTPUT AS #channel
OPEN filename$ FOR APPEND AS #channel
OPEN filename$ FOR RANDOM AS #channel [LEN = recordSize]
OPEN filename$ FOR BINARY AS #channel</code></pre>
<pre> Mode Description
---- -----------
INPUT Open for sequential reading. File must exist.
OUTPUT Open for sequential writing. Creates or truncates.
APPEND Open for sequential writing at end of file.
RANDOM Open for random-access record I/O.
BINARY Open for raw binary I/O.</pre>
<h3>CLOSE</h3>
<p>Closes an open file channel.</p>
<pre><code>CLOSE #channel</code></pre>
<h3>PRINT #</h3>
<p>Writes text to a file.</p>
<pre><code>PRINT #channel, expression</code></pre>
<h3>INPUT #</h3>
<p>Reads comma-delimited data from a file.</p>
<pre><code>INPUT #channel, variable</code></pre>
<h3>LINE INPUT #</h3>
<p>Reads an entire line from a file into a string variable.</p>
<pre><code>LINE INPUT #channel, variable$</code></pre>
<h3>WRITE #</h3>
<p>Writes comma-delimited data to a file. Strings are enclosed in quotes,
numbers are undecorated. Each statement writes a newline at the end.</p>
<pre><code>WRITE #channel, expr1, expr2, ...</code></pre>
<pre><code>Write #1, &quot;Scott&quot;, 42, 3.14
' Output: &quot;Scott&quot;,42,3.14</code></pre>
<h3>GET / PUT</h3>
<p>Read and write records in RANDOM or BINARY mode files.</p>
<pre><code>GET #channel, [recordNum], variable
PUT #channel, [recordNum], variable</code></pre>
<h3>SEEK</h3>
<p>Sets the file position. As a function, returns the current position.</p>
<pre><code>SEEK #channel, position ' Statement: set position
pos = SEEK(channel) ' Function: get current position</code></pre>
</div>
<div class="topic" id="lang.func.string">
<h1>String Functions</h1>
<h2>String Functions</h2>
<pre> Function Returns Description
-------- ------- -----------
ASC(s$) Integer ASCII code of first character of s$
CHR$(n) String Character with ASCII code n
FORMAT$(value, fmt$) String Formats a numeric value using format string
HEX$(n) String Hexadecimal representation of n
INSTR(s$, find$) Integer Position of find$ in s$ (1-based), 0 if not found
INSTR(start, s$, find$) Integer Search starting at position start
LCASE$(s$) String Converts s$ to lowercase
LEFT$(s$, n) String Leftmost n characters of s$
LEN(s$) Integer Length of s$
LTRIM$(s$) String Removes leading spaces from s$
MID$(s$, start [, length]) String Substring from position start (1-based)
RIGHT$(s$, n) String Rightmost n characters of s$
RTRIM$(s$) String Removes trailing spaces from s$
SPACE$(n) String String of n spaces
STR$(n) String Converts number n to string
STRING$(n, char) String String of n copies of char
TRIM$(s$) String Removes leading and trailing spaces from s$
UCASE$(s$) String Converts s$ to uppercase
VAL(s$) Double Converts string s$ to a numeric value</pre>
<h3>MID$ Assignment</h3>
<p>MID$ can also be used on the left side of an assignment to replace a portion
of a string:</p>
<pre><code>Mid$(s$, 3, 2) = &quot;XY&quot; ' Replace 2 characters starting at position 3</code></pre>
</div>
<div class="topic" id="lang.func.math">
<h1>Math Functions</h1>
<h2>Math Functions</h2>
<pre> Function Returns Description
-------- ------- -----------
ABS(n) Double Absolute value of n
ATN(n) Double Arctangent of n (in radians)
COS(n) Double Cosine of n (radians)
EXP(n) Double e raised to the power n
FIX(n) Integer Truncates n toward zero (removes fractional part)
INT(n) Integer Largest integer less than or equal to n (floor)
LOG(n) Double Natural logarithm (base e) of n
RND[(n)] Double Random number between 0 (inclusive) and 1 (exclusive)
SGN(n) Integer Sign of n: -1, 0, or 1
SIN(n) Double Sine of n (radians)
SQR(n) Double Square root of n
TAN(n) Double Tangent of n (radians)
TIMER Double Number of seconds since midnight</pre>
<blockquote><strong>Note:</strong> RND with a negative argument seeds and returns. RND(0) returns the previous
value. Use RANDOMIZE to seed the generator.</blockquote>
</div>
<div class="topic" id="lang.func.conversion">
<h1>Conversion Functions</h1>
<h2>Conversion Functions</h2>
<pre> Function Returns Description
-------- ------- -----------
CDBL(n) Double Converts n to Double
CINT(n) Integer Converts n to Integer (with banker's rounding)
CLNG(n) Long Converts n to Long
CSNG(n) Single Converts n to Single
CSTR(n) String Converts n to its String representation</pre>
</div>
<div class="topic" id="lang.func.fileio">
<h1>File I/O Functions</h1>
<h2>File I/O Functions</h2>
<pre> Function Returns Description
-------- ------- -----------
EOF(channel) Boolean True if file pointer is at end of file
FREEFILE Integer Next available file channel number
INPUT$(n, #channel) String Reads n characters from the file
LOC(channel) Long Current read/write position in the file
LOF(channel) Long Length of the file in bytes
SEEK(channel) Long Current file position (function form)
LBOUND(array [, dim]) Integer Lower bound of an array dimension
UBOUND(array [, dim]) Integer Upper bound of an array dimension</pre>
</div>
<div class="topic" id="lang.func.misc">
<h1>Miscellaneous Functions</h1>
<h2>Miscellaneous Functions</h2>
<pre> Function Returns Description
-------- ------- -----------
DATE$ String Current date as &quot;MM-DD-YYYY&quot;
TIME$ String Current time as &quot;HH:MM:SS&quot;
ENVIRON$(name$) String Value of environment variable name$
ERR Integer Current runtime error number (0 if no error)</pre>
</div>
<div class="topic" id="lang.forms">
<h1>Form and Control Statements</h1>
<h2>Form and Control Statements</h2>
<p>DVX BASIC supports Visual Basic-style forms and controls for building
graphical user interfaces. Forms are defined in .frm files and loaded at
runtime.</p>
<h3>Loading and Unloading Forms</h3>
<pre><code>LOAD FormName
UNLOAD FormName</code></pre>
<p>LOAD creates the form and its controls in memory. UNLOAD destroys the form
and frees its resources.</p>
<h3>Showing and Hiding Forms</h3>
<pre><code>FormName.Show [modal]
FormName.Hide
Me.Show [modal]
Me.Hide</code></pre>
<p>Pass vbModal (1) to Show for a modal dialog.</p>
<pre><code>Form2.Show vbModal
Me.Hide</code></pre>
<h3>Property Access</h3>
<p>Read and write control properties using dot notation:</p>
<pre><code>ControlName.Property = value
value = ControlName.Property</code></pre>
<pre><code>Text1.Text = &quot;Hello&quot;
label1.Caption = &quot;Name: &quot; &amp; name$
x = Text1.Left</code></pre>
<h3>Method Calls</h3>
<pre><code>ControlName.Method [args]</code></pre>
<pre><code>List1.AddItem &quot;New entry&quot;
List1.Clear</code></pre>
<h3>Me Keyword</h3>
<p>Me refers to the current form. Use it to access the form's own properties,
controls, and methods from within event handlers.</p>
<pre><code>Me.Caption = &quot;Updated Title&quot;
Me.Text1.Text = &quot;&quot;
Me.Hide</code></pre>
<h3>Control Arrays</h3>
<p>Multiple controls can share a name with unique indices. Access individual
controls with parenthesized indices:</p>
<pre><code>Option1(0).Value = True
Label1(idx).Caption = &quot;Item &quot; &amp; Str$(idx)
Me.Label1(i).Visible = True</code></pre>
<h3>DoEvents</h3>
<p>Yields control to the DVX event loop, allowing the GUI to process pending
events. Call this in long-running loops to keep the UI responsive.</p>
<pre><code>DOEVENTS</code></pre>
<pre><code>For i = 1 To 10000
' process data
If i Mod 100 = 0 Then DoEvents
Next</code></pre>
<h3>MsgBox</h3>
<p>Displays a message box dialog. Can be used as a statement (discards result)
or as a function (returns the button clicked).</p>
<pre><code>MSGBOX message$ [, flags]
result = MSGBOX(message$ [, flags])</code></pre>
<pre><code>MsgBox &quot;Operation complete&quot;
answer = MsgBox(&quot;Continue?&quot;, vbYesNo + vbQuestion)
If answer = vbYes Then
' proceed
End If</code></pre>
<h3>InputBox$</h3>
<p>Displays an input dialog and returns the user's text entry.</p>
<pre><code>result$ = INPUTBOX$(prompt$ [, title$ [, default$]])</code></pre>
<pre><code>name$ = InputBox$(&quot;Enter your name:&quot;, &quot;Name Entry&quot;, &quot;&quot;)</code></pre>
<h3>Event Handler Convention</h3>
<p>Event handlers are named ControlName_EventName and defined as SUBs:</p>
<pre><code>Sub Command1_Click()
MsgBox &quot;Button clicked!&quot;
End Sub
Sub Form_Load()
Me.Caption = &quot;My App&quot;
End Sub
Sub Text1_Change()
Label1.Caption = &quot;You typed: &quot; &amp; Text1.Text
End Sub</code></pre>
<h4>Common Events</h4>
<pre> Event Description
----- -----------
Click Control was clicked
DblClick Control was double-clicked
Change Control value/text changed
KeyPress Key was pressed (receives key code)
KeyDown Key went down (receives key code and shift state)
KeyUp Key was released
MouseDown Mouse button pressed
MouseUp Mouse button released
MouseMove Mouse moved over control
GotFocus Control received input focus
LostFocus Control lost input focus
Form_Load Form is being loaded
Form_Unload Form is being unloaded
Form_Resize Form was resized
Timer Timer interval elapsed</pre>
</div>
<div class="topic" id="lang.sql">
<h1>SQL Functions</h1>
<h2>SQL Functions</h2>
<p>DVX BASIC includes built-in SQLite database support through a set of SQL
functions. All functions use database handles and result set handles
(integers) returned by SQLOpen and SQLQuery.</p>
<h3>Opening and Closing Databases</h3>
<h4>SQLOpen</h4>
<p>Opens a SQLite database file and returns a database handle.</p>
<pre><code>db = SQLOPEN(path$)</code></pre>
<pre><code>db = SQLOpen(App.Data &amp; &quot;\mydata.db&quot;)</code></pre>
<h4>SQLClose</h4>
<p>Closes an open database.</p>
<pre><code>SQLCLOSE db</code></pre>
<h3>Executing SQL</h3>
<h4>SQLExec</h4>
<p>Executes a SQL statement that does not return data (INSERT, UPDATE, DELETE,
CREATE TABLE, etc.). Can be used as a statement or as a function returning a
Boolean success flag.</p>
<pre><code>SQLEXEC db, sql$
ok = SQLEXEC(db, sql$)</code></pre>
<pre><code>SQLExec db, &quot;CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)&quot;
SQLExec db, &quot;INSERT INTO users (name) VALUES ('Scott')&quot;
ok = SQLExec(db, &quot;DELETE FROM users WHERE id = 5&quot;)</code></pre>
<h4>SQLAffected</h4>
<p>Returns the number of rows affected by the last INSERT, UPDATE, or DELETE.</p>
<pre><code>count = SQLAFFECTED(db)</code></pre>
<h3>Querying Data</h3>
<h4>SQLQuery</h4>
<p>Executes a SELECT query and returns a result set handle.</p>
<pre><code>rs = SQLQUERY(db, sql$)</code></pre>
<pre><code>rs = SQLQuery(db, &quot;SELECT id, name FROM users ORDER BY name&quot;)</code></pre>
<h4>SQLNext</h4>
<p>Advances to the next row in the result set. Can be used as a statement or as
a function returning True if a row is available.</p>
<pre><code>SQLNEXT rs
hasRow = SQLNEXT(rs)</code></pre>
<h4>SQLEof</h4>
<p>Returns True if there are no more rows in the result set.</p>
<pre><code>done = SQLEOF(rs)</code></pre>
<h3>Reading Fields</h3>
<h4>SQLField$</h4>
<p>Returns a field value as a string. The field can be specified by column
index (0-based) or by column name.</p>
<pre><code>value$ = SQLFIELD$(rs, columnIndex)
value$ = SQLFIELD$(rs, &quot;columnName&quot;)</code></pre>
<pre><code>name$ = SQLField$(rs, &quot;name&quot;)
first$ = SQLField$(rs, 0)</code></pre>
<h4>SQLFieldInt</h4>
<p>Returns a field value as an integer.</p>
<pre><code>value = SQLFIELDINT(rs, columnIndex)</code></pre>
<h4>SQLFieldDbl</h4>
<p>Returns a field value as a double.</p>
<pre><code>value# = SQLFIELDDBL(rs, columnIndex)</code></pre>
<h4>SQLFieldCount</h4>
<p>Returns the number of columns in the result set.</p>
<pre><code>count = SQLFIELDCOUNT(rs)</code></pre>
<h3>Result Set Cleanup</h3>
<h4>SQLFreeResult</h4>
<p>Frees a result set. Always call this when done iterating a query.</p>
<pre><code>SQLFREERESULT rs</code></pre>
<h3>Error Information</h3>
<h4>SQLError$</h4>
<p>Returns the last error message for the database.</p>
<pre><code>msg$ = SQLERROR$(db)</code></pre>
<h3>Complete SQL Example</h3>
<pre><code>Dim db As Long
Dim rs As Long
db = SQLOpen(App.Data &amp; &quot;\contacts.db&quot;)
SQLExec db, &quot;CREATE TABLE IF NOT EXISTS contacts (name TEXT, phone TEXT)&quot;
SQLExec db, &quot;INSERT INTO contacts VALUES ('Alice', '555-1234')&quot;
rs = SQLQuery(db, &quot;SELECT name, phone FROM contacts&quot;)
Do While Not SQLEof(rs)
SQLNext rs
Print SQLField$(rs, &quot;name&quot;); Tab(20); SQLField$(rs, &quot;phone&quot;)
Loop
SQLFreeResult rs
SQLClose db</code></pre>
</div>
<div class="topic" id="lang.app">
<h1>App Object</h1>
<h2>App Object</h2>
<p>The App object provides read-only properties for the application's directory
paths.</p>
<pre> Property Returns Description
-------- ------- -----------
App.Path String Directory containing the application's executable
App.Config String Directory for application configuration files
App.Data String Directory for application data files (databases, etc.)</pre>
<pre><code>configFile$ = App.Config &amp; &quot;\settings.ini&quot;
dbPath$ = App.Data &amp; &quot;\myapp.db&quot;
Print &quot;Running from: &quot; &amp; App.Path</code></pre>
</div>
<div class="topic" id="lang.ini">
<h1>INI Functions</h1>
<h2>INI Functions</h2>
<p>DVX BASIC provides built-in functions for reading and writing standard INI
configuration files.</p>
<h3>IniRead</h3>
<p>Reads a value from an INI file. Returns the default value if the key is not
found.</p>
<pre><code>value$ = INIREAD(file$, section$, key$, default$)</code></pre>
<pre><code>name$ = IniRead(App.Config &amp; &quot;\app.ini&quot;, &quot;User&quot;, &quot;Name&quot;, &quot;Unknown&quot;)
fontSize = Val(IniRead(App.Config &amp; &quot;\app.ini&quot;, &quot;Display&quot;, &quot;FontSize&quot;, &quot;12&quot;))</code></pre>
<h3>IniWrite</h3>
<p>Writes a value to an INI file. Creates the file, section, or key if they do
not exist.</p>
<pre><code>INIWRITE file$, section$, key$, value$</code></pre>
<pre><code>IniWrite App.Config &amp; &quot;\app.ini&quot;, &quot;User&quot;, &quot;Name&quot;, &quot;Scott&quot;
IniWrite App.Config &amp; &quot;\app.ini&quot;, &quot;Display&quot;, &quot;FontSize&quot;, Str$(fontSize)</code></pre>
</div>
<div class="topic" id="lang.constants">
<h1>Predefined Constants</h1>
<h2>Predefined Constants</h2>
<p>The following constants are predefined by the compiler and available in all
programs.</p>
<h3>MsgBox Button Style Flags</h3>
<pre> Constant Value Description
-------- ----- -----------
vbOKOnly 0 OK button only (default)
vbOKCancel 1 OK and Cancel buttons
vbYesNo 2 Yes and No buttons
vbYesNoCancel 3 Yes, No, and Cancel buttons
vbRetryCancel 4 Retry and Cancel buttons</pre>
<h3>MsgBox Icon Flags</h3>
<p>Add an icon flag to the button style to display an icon in the message box.</p>
<pre> Constant Value Description
-------- ----- -----------
vbInformation &amp;H10 Information icon
vbExclamation &amp;H20 Warning icon
vbCritical &amp;H30 Error/critical icon
vbQuestion &amp;H40 Question mark icon</pre>
<h3>MsgBox Return Values</h3>
<pre> Constant Value Description
-------- ----- -----------
vbOK 1 User clicked OK
vbCancel 2 User clicked Cancel
vbYes 3 User clicked Yes
vbNo 4 User clicked No
vbRetry 5 User clicked Retry</pre>
<h3>Show Mode Flags</h3>
<pre> Constant Value Description
-------- ----- -----------
vbModal 1 Show form as modal dialog</pre>
<h3>Boolean Constants</h3>
<pre> Constant Value Description
-------- ----- -----------
True -1 Boolean true
False 0 Boolean false</pre>
</div>
</main>
</body>
</html>