|
-
Dec 14th, 2001, 02:05 PM
#1
Thread Starter
Lively Member
ActiveX DLL Error handling problem
Hi,
I am having a problem generating an error trap in my code.
The main form:
Private Sub Command1_Click()
On Error GoTo InputError:
' Dimentions
Dim au As cAuthor
Set au = New cAuthor
au.Author_FirstName = GUI.Text1
au.Author_LastName = GUI.Text2
'Report the authors name in parsed format
MsgBox au.ReportName
'Clear reference
Set au = Nothing
Exit Sub
InputError:
MsgBox "Error:" & Err.Number & vbCrLf & Err.Description, vbExclamation, Err.Source
End Sub
I have an ActiveX DLL (Class Module) that does the error checking:
Option Explicit
'Local varaiable(s) to holde property value(s)
Private mvarAuthor_FirstName As String
Private mvarAuthor_LastName As String
Public Property Let Author_LastName(ByVal vData As String)
If Trim(vData) = "" Then
--> Err.Raise 6001, "Invalid Input", "Please enter the Auter's Last Name."
Else
mvarAuthor_LastName = vData
End If
End Property
Public Property Get Author_LastName() As String
Author_LastName = mvarAuthor_LastName
End Property
Public Property Let Author_FirstName(ByVal vData As String)
If Trim(vData) = "" Then
Err.Raise 6002, "Invalid Input", "Please enter the Auter's First Name."
Else
mvarAuthor_FirstName = vData
End If
End Property
Public Property Get Author_FirstName() As String
Author_FirstName = mvarAuthor_FirstName
End Property
Public Function ReportName() As String
ReportName = mvarAuthor_LastName & ", " & mvarAuthor_FirstName
End Function
When I have no text for GUI.Text2 (Last Name), I wanted to generate an error from the class module and trap it in the main form. But when I run this I get a message box generated from the Class module instead of trapping it in the main form.
Does anyony have any ideas?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|