Declare Custom Data Type Method
The Declare Custom Data Type method declares a custom data type. It does not return a value. For more information, see About Data Types.
Format
Type userType
field1 As type1
field2 As type2
...
End Type
The following table describes the arguments that you can use with this method.
Argument | Description |
---|---|
userType |
The name of the custom data type. |
field1, field2 |
Each argument specifies the name of a field in the custom type. |
type1, type2 |
Each argument specifies the data type of the field. |
Usage
You can use the following format to access the fields of a record:
recordName.fieldName
You can use the following format to access the fields of an array of records:
arrayName(index).fieldName
You cannot specify an array in the field argument. Arrays of records are allowed.
You cannot use the Type statement in a procedure definition. You must use it in the general declarations section. For example, see Set Array Lower Boundary Method.
Siebel VB cannot pass a custom type to a COM function or subroutine.
To declare a record variable, you can use the Declare Custom Data Type method in a Declare Variable method. Siebel VB does not allocate memory when you define a custom type. It only allocates memory if you use a Declare Variable method to declare a custom type. If you declare a variable of a custom type, then you are instantiating the type. For more information, see Declare Variable Statement.
Example
The following example includes a Type statement and a Dim statement. You must define a record type before you can declare a record variable. The subroutine references a field in the record:
Type Testrecord
Custno As Integer
Custname As String
End Type
Sub Button_Click
Dim myrecord As Testrecord
Dim msgText As String
i:
myrecord.custncustomame = "Chris Smith"
If myrecord.custname = "" then
Exit Sub
End If
End Sub