Understanding the CompressedFolder Class - Examining the Properties
(Page 2 of 4 )
My CompressedFolder class needed to have a few basic properties. I wanted to form them to resemble the properties used by the FileSystemObject’s own Folder object. I figured this would be the most intuitive way to create my object, by making it easier for users in the end. Here’s a snapshot of the code I used to create the properties.
Public Property Get FullName
FullName = m_fileName
End Property
Private Property Let FullName(strName)
m_fileName = strName
End Property
Public Property Get Filename
Filename = Right(FullName, Len(FullName) - InStrRev(FullName, ""))
End Property
Public Property Get Path
Path = Left(FullName, InStrRev(FullName, ""))
End Property
Public Property Get Count
Count = GetItemCount(FullName)
End Property
As you can see, there are four different properties available: FullName, Filename, Path, and Count. The first three all deal with the path and filename of the compressed folder, and the last returns the number of items in the compressed folder.
I wanted to provide these specific properties to make coding with my object easier for the programmer.
Since the first three properties were closely related, I decided to code them together, building each one off of the next. This eliminated extraneous calls to outside objects, which should hopefully increase my class’s performance. In this case, a few simple string manipulations are also less complicated than second and third calls to the FileSystemObject for each of the subsequent properties.
Next: More on Properties >>
More Code Examples Articles
More By Nilpo