Hello All,
Can anyone teach me how and where to use the Property Get, Let and Set. Pls give me some examples.
Thank you. Its very urgent.
Regards,
Venkat.
Printable View
Hello All,
Can anyone teach me how and where to use the Property Get, Let and Set. Pls give me some examples.
Thank you. Its very urgent.
Regards,
Venkat.
This is how I think of them:
Property Get is when the client is GETTING the information from your class
Property Let is when the client is LETTING (assigning) the information to your class
Property Set is when the client is SETTING OBJECTS in your class
==========================================
You will also have private variables within your class that represent the values of the object. YOu use property let/set/get so you can validate the input before you assign a value to the internal variable, otherwise you can raise an error.
HTH
Tom
Code Sample:
Code:private m_lngOrderID as long
Public Property Let OrderID(vNewValue as long)
if vnewvalue > 0 then
m_lngOrderID = vnewvalue
else
err.raise 1,"", "Invalid Order ID!"
end if
end property
Public Property Get OrderID() as long
orderid = m_lngOrderID
end property
Hey, thanx pal..got little bit confidence and i would proceed with this.
Regards,
Venkat.
Have a look at:
http://www.vb-world.net/activex/activex/
For a tutorial on ActiveX and controls.
------------------
John Percival
Editor, VB-World.net
[email protected]