SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 164 | Next

Jim DeMarco

"Pro Excel 2007 VBA"

We may also want to add a property that returns the
employee??™s full name. Add the read-only FullName property to cPerson:
CHAPTER 4 n USERFORMS 164
Property Get FullName() As String
Dim sReturn As String
Dim blnMidInit As Boolean
blnMidInit = Len(m_sMidInit & "") > 0
If blnMidInit Then
sReturn = m_sFName & " " & m_sMidInit & " " & m_sLName
Else
sReturn = m_sFName & " " & m_sLName
End If
FullName = sReturn
End Property
That??™s all we need for our cPerson class. Now we??™ll fill in our cAddress, cEquipment, and
cAccess objects. Then we??™ll start putting our wizard application together. These classes are
mapped directly to the screen elements from our HRWizard UserForm. The entirety of their
code is shown in Listings 4-1 through 4-3.
Listing 4-1. The cAddress Class
Private m_lngID As Long
Private m_sStreetAddress As String
Private m_sStreeAddress2 As String
Private m_sCity As String
Private m_sState As String
Private m_sZipCode As String
Private m_sPhoneNumber As String
Private m_sCellPhone As String
'
Public Property Get ID() As Long
ID = m_lngID
End Property
Public Property Let ID(newID As Long)
m_lngID = newID
End Property
Public Property Get StreetAddress() As String
StreetAddress = m_sStreetAddress
End Property
Public Property Let StreetAddress(newAddress As String)
m_sStreetAddress = newAddress
End Property
CHAPTER 4 n USERFORMS 165
Public Property Get StreetAddress2() As String
StreetAddress2 = m_sStreeAddress2
End Property
Public Property Let StreetAddress2(newAddress2 As String)
m_sStreeAddress2 = newAddress2
End Property
Public Property Get City() As String
City = m_sCity
End Property
Public Property Let City(newCity As String)
m_sCity = newCity
End Property
Public Property Get State() As String
State = m_sState
End Property
Public Property Let State(newState As String)
m_sState = newState
End Property
Public Property Get ZipCode() As String
ZipCode = m_sZipCode
End Property
Public Property Let ZipCode(newZipCode As String)
m_sZipCode = newZipCode
End Property
Public Property Get PhoneNumber() As String
PhoneNumber = m_sPhoneNumber
End Property
Public Property Let PhoneNumber(newPhoneNumber As String)
m_sPhoneNumber = newPhoneNumber
End Property
Public Property Get CellPhone() As String
CellPhone = m_sCellPhone
End Property
Public Property Let CellPhone(newCellPhone As String)
m_sCellPhone = newCellPhone
End Property
CHAPTER 4 n USERFORMS 166
Listing 4-2.


Pages:
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176