|
-
Feb 24th, 2000, 08:01 AM
#1
Hi everyone. I am working on an ActiveX DLL class module using VB5. The class has two properties, UserPassword and UserName. I would like to fire an event if a user didn't fill in any of the two fields. Here is part of my code, please correct me if I am wrong because I couldn't get this source code to fire the events I create. Thanks.
**** In my COM module under the General Declaration: ****
Public Event PasswordMissing()
Public Event UserNameMissing()
Public Property Let UserName(ByVal vData As String)
If (vData = "") Or IsNull(vData) Then
RaiseEvent UserNameMissing
Else
mvarUserName = vData
End If
End Property
Public Property Get UserName() As String
UserName = mvarUserName
End Property
Public Property Let UserPassword(ByVal vData As String)
If (vData = "") Or IsNull(vData) Then
RaiseEvent PasswordMissing
Else
mvarUserPassword = vData
End If
End Property
Public Property Get UserPassword() As String
UserPassword = mvarUserPassword
End Property
**** Now here is what I wrote in my program: ****
**** Under General Declaration ****
Dim WithEvents Missing As Extra
Private Sub cmdOK_Click() 'Command button in logon form
Dim startconnect As Extra 'Extra == Name of my class
Set startconnect = New Extra
startconnect.UserName = Me.txtUserName
startconnect.UserPassword = Me.txtPassword
End sub
Private Sub Missing_PasswordMissing()
MsgBox "Missing Password."
End Sub
Private Sub Missing_UserNameMissing()
MsgBox "Missing User Name."
End Sub
Hope the above code is clear as to what I am trying to do. Again thanks for your time reading this. 
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
|