Bookshelf Home | Contents | Index | PDF |
Siebel VB Language Reference > VB Language Reference > Type StatementThis standard VB statement declares a user-defined type. SyntaxType userType ReturnsUsageThe user-defined type declared by Type can be used in a Dim statement to declare a record variable. A user defined type is sometimes referred to as a record type or a structure type. Field cannot be an array. However, arrays of records are allowed. The Type statement is not valid inside a procedure definition. It must be placed in the (general) (declarations) section, shown in Option Base Statement. User defined Types cannot be passed to COM Object functions or subroutines. To access the fields of a record, use syntax of the form: To access the fields of an array of records, use syntax of the form: No memory is allocated when a type is defined. Memory is allocated when a variable of the user defined type is declared with a Dim statement. Declaring a variable of a user defined type is called instantiating, or declaring an instance of, the type. ExampleThis example shows a Type and Dim statement for a record. You must define a record type before you can declare a record variable. The subroutine then references a field within the record. Type Testrecord Sub Button_Click See Also |
Siebel VB Language Reference |