Declares a Get property procedure used to assign a value to a property.
[ <attrlist> ] Get() [ block ] End Get
Each attribute in the attrlist part has the following syntax and parts:
attrname [({ attrargs | attrinit })]
Get property procedures can return a value using either the Return keyword or by assigning the return value to the property where the get procedure is declared. The value returned by a Get property procedure is usually a private class level variable that stored the property value after a property set operation.
This example uses the Get statement to return the value of a property.
Class PropClass
' Define a local variable to store the property value.
Private CurrentTime As String
' Define the property.
Public ReadOnly Property DateAndTime() As String
Get
' Get procedure is called when the value
' of a property is retrieved.
CurrentTime = CStr(Now)
Return CurrentTime ' Returns the date and time As a string.
End Get
End Property
End Class