PDA

Click to See Complete Forum and Search --> : Set and Let Property????


AmazingJoy
May 17th, 2001, 02:48 AM
Hi guys! Can anyone please explain me the difference between the two? Sorry, I'm a newbie here and my question might sound stupid to you but hey! It's better to ask that to assume... :D

FATBOYPEE
May 17th, 2001, 04:38 AM
The property settings Let & Get

are commonly used to interface any variables that are not objects (ie Integer Long, String etc). You need 3 things for Read & Write:

a Let property to put your data in

A Get property to Get your data out

and a private container of the same type you Let & Get:

' Declaration of Private Data Container used for anything but objects
Private m_MysTring as String

' Public interface to place data variables (anything but objects)
Public Property Let myString(byval sMyString as String)
' Place any manipulation code also in here
m_MsyString = sMyString

End Property

Public Property Get MyString() as String
' Place any other manipulation code in here.
MyString = m_MysTring

End Property

Set on the other hand is for objects: Typically you need 3 things

' Private Variable Container
Private m_ADODBRS as ADODB.RecordSet

' Set Property
Public Property Set ADODBRS (ARS as ADODB.RecordSet)

Set m_ADODBRS = ARS

End Property

' Get Property
Public Property Get ADODBRS() as ADODB.RecordSet

Set ADODBRS = m_ADODBRS

End Property

FATBOYPEE

AmazingJoy
May 17th, 2001, 04:44 AM
That was a great help!