Example - Property LastError (read-only)
Visual Basic
Public Function GetLastErrorText() As String
Dim lErrNo As Long
Dim strRetVal As String
'Get the value of the last Error
lErrNo = RedReg.LastError
Select Case lErrNo
Case ERR_REDREG_BADKEY
strRetVal = "Keyname is empty when calling SaveRegistration or LoadRegistration"
Case ERR_REDREG_BADUSERNAME
strRetVal = "Invalid size in UserName"
Case ERR_REDREG_BADCOMPANYNAME
strRetVal = "Invalid size in CompanyName"
Case ERR_REDREG_BADREGKEY
strRetVal = "Internal error creating registry key"
Case ERR_REDREG_INVALID_REGCODE
strRetVal = "Registration code is not valid."
Case ERR_REDREG_OVER_RUNTIMES
strRetVal = "Program has exceed registered Run times. Please Register"
Case ERR_REDREG_PAST_EXPIRE_DATE
strRetVal = "RedRegistration has expired. Please register"
Case ERR_REDREG_INVALID_EXPIRE_DATE
strRetVal = "Invalid Expiration Date in Registration Code"
Case ERR_REDREG_INVALID_RUNTIMES
strRetVal = "Invalid RunTimes in Registration Code"
Case ERR_REDREG_INVALID_USERCOUNT
strRetVal = "Invalid UserCount in Registration Code"
Case Else 'No Error, or unhandled
strRetVal = Empty
End If
GetLastErrorText = strRetVal
End Function