Example:

  1. ' This sample shows some of the features of user defined types and the with

    ' statement

     

    Type type1

    1. a As Integer

      d As Double

      s As String

    End Type

     

    Type type2

    1. a As String

      o As type1

    End Type

     

    Dim type1a As type1

    Dim type2a As type2

     

    Sub Main ()

    1. With type1a

      1. .a = 65

        .d = 3.14

      End With

       

      With type2a

      1. .a = "Hello, world"

        With .o

        1. .s = "Goodbye"

        End With

       

      End With

       

      type1a.s = "YES"

      MsgBox type1a.a

      MsgBox type1a.d

      MsgBox type1a.s

      MsgBox type2a.a

      MsgBox type2a.o.s

    End Sub