Set Statement

This statement begins a Set procedure block within a Property procedure definition.

Set (parameter_nameAstype)

Prerequisites

Parameters

parameter_name

The name of the parameter that contains the new value to which the property is being set.

type

The type of the parameter_name parameter. This type must be identical to the type of the Property that contains the Set statement.

Remarks

The Set procedure block must always end with an End Set statement.

Unlike VB.NET, the clause (parameter_nameAstype) must always be specified.

When a procedure sets the containing Property, the new value for the property is copied to the parameter_name variable, and the Set procedure is executed. It is up to that procedure to use or save the new value as desired.

Examples

Class cc
Private size_value As Integer
Public WriteOnly Property size As Integer 'Set size, clip value at 10
Set (value As Integer)
If value > 10 Then
value = 10
End If
size_value = value
End Set
End Property
End Class

:
Dim obj As New cc
obj.size = 20 'Sets size_value

See Also

Statements |PropertyStatement| GetStatement