Results 1 to 7 of 7

Thread: Class

  1. #1

    Thread Starter
    Hyperactive Member WP's Avatar
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    278

    Angry

    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

    Visual Basic 6.0 EE SP5 / .Net
    Windows XP

  2. #2
    Guest
    Use Set MyClass = Nothing.

  3. #3

    Thread Starter
    Hyperactive Member WP's Avatar
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    278

    Exclamation sorry

    Sorry, didn't work:
    "Variable not definied"

    WP

    Visual Basic 6.0 EE SP5 / .Net
    Windows XP

  4. #4
    Guest
    Change MyClass to the variable you were using in place of your class.

    Or you can remove Option Explicit from your project.

  5. #5

    Thread Starter
    Hyperactive Member WP's Avatar
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    278

    Angry Didn't work

    Not working, did you test it?

    WP

    Visual Basic 6.0 EE SP5 / .Net
    Windows XP

  6. #6
    Guest
    Yes, it works for me.
    Code:
    Dim X As New Class1
    
    '<--Do code there-->
    
    Set X = Nothing

  7. #7

    Thread Starter
    Hyperactive Member WP's Avatar
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    278
    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.

    Visual Basic 6.0 EE SP5 / .Net
    Windows XP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width