Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need explanation on Public Property Let/Set 1

Status
Not open for further replies.

janicefoo

Programmer
Apr 17, 2003
53
0
0
MY
Dear members and gurus,
I am very new to VB. I saw some codes written in VB6 but not sure what does those codes mean. Would be very glad if someone could explain Public Property Let/Get code as below:

Code:
Public Property Get Mp3File() As String
Mp3File = m_sFileOut
End Property

Public Property Let Mp3File(ByVal Value As String)
If Not (FileExists(Value)) Then
m_sFileOut = Value
Else
Kill Value
m_sFileOut = Value
End If
End Property
[\CODE]

How to use Let and Get and what is the difference between Set? Looking forward to some replies soon.

Thanks in advance,
Janice
 
The MP3File property is exposed to anything calling this object, and basically populates / returns a class module level string called m_SFileOut.

When populating it however, it first checks that there isn't a file already existing with this path. If there is, it is deleted.

Let and Set are two different ways of assigning properties. Let is the one that I use more often than not, because it deals with "intrinsic" types like string, integer etc. With Set, you can assign a reference to another object, but you can do this in a Let as well so long as you use a set statement in the prodecure - which is what I usually do...

mmilan.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top