Expected Expression Error: Dynamic Array Not OK in User- Type (108709)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 2.0
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 2.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
This article was previously published under Q108709 SYMPTOMS
An "Expected: expression" error occurs within a Type statement in Visual
Basic when you follow an array name with empty parentheses ().
You can use the Type ... End Type statement block to define your own data
type using Basic's predefined data types as components. You can dimension
variables or arrays using that user-defined type.
CAUSE
Visual Basic interprets the empty parentheses () that follow a variable
name in the Type statement as a declaration of a dynamic array. Visual
Basic does not allow dynamic arrays to be declared within a user-defined
Type statement block.
RESOLUTION
Within the Type ... End Type statement block, parentheses that follow a
variable name must contain a number to indicate the number of elements
in a static array. Visual Basic allows Type statements to contain static
arrays but not dynamic arrays.
NOTE: Once you correctly define a user-defined type, you can dimension a
dynamic array of that type. See further below for an example.
STATUS
This behavior is by design.
REFERENCES
Visual Basic version 3.0 for Windows, "Programmer's Guide," Chapter 7,
"User-Defined Types (Structures)", pages 176-178. A user-defined type
can contain an ordinary (fixed-size) array, but not a dynamic array.
Modification Type: | Major | Last Reviewed: | 12/9/2003 |
---|
Keywords: | kbcode KB108709 |
---|
|