-
I'm making an activeX DLL in vb, and I want to terminate the class when they typed the wrong password.
How to?
Code:
Public Sub Class_Initialize()
If (CheckPassword) Then
'Everything is fine
Else
'Stop this class,
'When they want to use something of this class,
'it first has to be re-initialized.
End If
End Sub
-
Use Set MyClass = Nothing.
-
sorry
Sorry, didn't work:
"Variable not definied"
WP
-
Change MyClass to the variable you were using in place of your class.
Or you can remove Option Explicit from your project.
-
Didn't work
Not working, did you test it?
WP
-
Yes, it works for me.
Code:
Dim X As New Class1
'<--Do code there-->
Set X = Nothing
-
Ok, there was a misunderstanding. I have the following:
Project 1 (Type=ActiveX DLL)
-Class1
Project 2 (Type=Standard EXE)
-Just a form
(These projects are not in a group, they are seperated)
Code:
'Project 1
Public Sub CheckPassword(...)
If Password is correct then everything is fine
If Password is incorrect, this class has to be terminated
End Sub
'Project2
Dim MyFunctions As New Class1
Public Sub Cmd1_Click()
MyFunctions.CheckPassword(...)
End Sub
You see? I don't want to terminate that class in project2, I want to terminate it directly in the class.