Type Statement

Define non-UNO data structures.

A Type structure is an ordered collection of data fields, that can be manipulated as a single item.

Sintaxi:

Type expressi贸


         Type struct_name
             DataField1 As TypeName1
             DataField2 As TypeName2
             (...)
         End Type ' struct_name
     
array fragment

array fragment


      ( [[start To] end], .. )
    
Par脿metres

inicia el amb un l铆mit inferior d'una dimensi贸.

end Superior l铆mit d'una dimensi贸.

Multiple dimensions for an array are denoted using comma (,) sign.

typename fragment

primitive data types fragment


      {Boolean|Byte|Currency|Date|Double|Integer|Long|Object|Single|String|Variant}
    
note

Extended types such as Type statement structures, UNO objects or ClassModule objects are valid typenames.


char fragment

type declaration car脿cters


      { % | & | ! | # | $ | @ }
    
note

A Type structure scope is that of the module it belongs to.


Exemple:


         Type Customer
             Name1 As String
             City As String
         End Type ' Customer structure
         Sub setCustomer
             Dim oCustomer as New Customer
             oCustomer.Name1 = "The Document Foundation"
             oCustomer.City = "Berlin"
         End Sub
     
tip

Enumerations can be created using Type statement definitions. Calling Python Scripts from Basic illustrates that mechanism.


Ens cal la vostra ajuda!