Monday, January 5, 2009

Basic Techniques Of VB Part Two

UDT
In Visual Basic, we can create your own type of data, which is known by the term UDT (User-Defined Type). Generally do when we need specific data types that are not available in Visual Basic.

In principle, UDT can be declared as Public or Private. However, in Visual Basic 6, all the modules can include the definition of Public UDT, except form. Therefore, if you define the form in the UDT, use the Private access modifier. Example of implementation as follows:


Private Type Supplier
Name As String
Address As String
End Type

Once we finished defining the structure of the UDT, we can declare a variable and then assign the item or the attribute. How to access them using a period as follows:

'Declare a variable with the type UDT
Dim Spl As Supplier

Spl.Name = "PT. AUBISOFT"
Spl.Address = "Jl. Cipinang Pisangan Timur No. 12"

With Spl
Print.Name
Print.Address
End With

0 comments: