Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 

With...End With allows you to perform a series of statements on a specified UDT variable without the need to type the name of the UDT variable.

 

Syntax

 

WITH UDTVariable[(index)]

 

 [statements]

 

END WITH

 

Returns

 

None

 

Parameters

 

Remarks

 

You can nest With...End With structures by placing one structure within another up to 25 levels.

However, because members of outer statements are masked inside the inner statements, you must provide a fully qualified UDT reference in an inner With block to any member of an object in an outer With block.

 

Restrictions

 

If the UDT Variable is an array of UDT, variable must be specified with the array index to be accessed.

 

See also

 

Examples

 

Type MyType

    a As Long

    b As Long

    s As String * 100

End Type

 

Dim x As MyType

Dim y As MyType

 

'---Up to 25 nested WITH levels

With x

    .a = 10

    With y

        .a = 1

        .b = 2

        .s = "This is Y"

    End With

 

    .b = 20

    .s = "This is X"

End With

 

With x

    .a += .a * .b

    .s = trim$(.s) + "-Added later"

End With

 

MSGBOX 0, _

            "---The following is X---" & $crlf & _

                $Tab & x.a & $crlf & _

                $Tab & x.b & $crlf & _

                $Tab & x.s & $crlf & _

            "---The following is Y---" & $crlf & _

                $Tab & y.a & $crlf & _

                $Tab & y.b & $crlf & _

                $Tab & y.s & $crlf & _

            ""

 

Dim ax(10) As MyType

 

With ax(5)

  .a = 25

End With

 

MSGBOX 0, "Used with array of UDT: " & ax(5).a

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software