Property Get

used to retrieve a property of a class.


This is exactly the same as just using a private variable.

Public Property Get Department() As String 
   Department = msDepartment
End Property

The following line gets the department by calling the property Get procedure

Call MsgBox(objEmployee.Department) 

Public Property Get HoursPerWeek() As Double 
   HoursPerWeek = mdbNormalHours + mdbOvertimeHours
End Property

Returns a property object reference

Public Property Get SomeThing() As Object 
   Set SomeThing = m_objObject
End Property


Read Only Properties


This property only has a Property Get (no Property Let) which means that it is read-only.

Public Property Get NormalHours() As Double 
   NormalHours = mdbNormalHours
End Property

This property only has a Property Get (no Property Let) which means that it is read-only.

Public Property Get OvertimeHours() As Double 
   OvertimeHours = mdbOvertimeHours
End Property


© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext