CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2001
    Posts
    6

    BUG Fixing for terminate objects

    There's a microsoft bug in VB. The class event terminate is not triggered when I set to nothing his object in a calling object. Is there a bug fixing of this? I'm not searching for a work around. Please give me some news.
    Bye
    Peppe


  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: BUG Fixing for terminate objects

    This is working fine for me... are you up-to-date on service paks, etc?


  3. #3
    Join Date
    Oct 2001
    Posts
    6

    Re: BUG Fixing for terminate objects

    Yes, I updated my Visual Studio with Service Pack 3


  4. #4
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: BUG Fixing for terminate objects

    So this doesn't work for you...?


    'In form Module
    option Explicit

    private Sub Form_Load()
    Dim o as Class1
    set o = new Class1
    set o = nothing
    End Sub
    'In Class Module
    option Explicit

    private Sub Class_Terminate()
    MsgBox "Terminate Event"
    End Sub





  5. #5
    Join Date
    Oct 2001
    Posts
    6

    Re: BUG Fixing for terminate objects

    no that works, instead this doesn't work:

    class1
    private o as class2
    end class

    sub class1_terminate
    set o = nothing
    end sub

    sub class2_terminate
    msgbox ("terminating")
    end sub





  6. #6
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: BUG Fixing for terminate objects

    Just from the code you posted, it doesn't look like Class2 ever get instantiated try this code...


    'In Form module...
    option Explicit

    private Sub Command1_Click()
    Dim o as Class1
    set o = new Class1
    set o = nothing
    End Sub

    'In Class1 Module...
    option Explicit
    Dim o as Class2
    private Sub Class_Initialize()
    'This is the line I don't see in your code...
    'So your Class2 was already nothing and thus
    'No Terminate should/would fire....
    set o = new Class2
    End Sub

    private Sub Class_Terminate()
    set o = nothing
    MsgBox "Class 1 Terminate"
    End Sub

    'In Class2 Module...
    option Explicit

    private Sub Class_Terminate()
    MsgBox "Class 2 Terminate"
    End Sub






  7. #7
    Join Date
    Oct 2001
    Posts
    6

    Re: BUG Fixing for terminate objects

    Very very strange. I built an example similar to your. It works. But my project doesn't. I debugged it and I've seen that it doesn't fire the terminate event. It's very strange. I don't understand why. Maybe something in my class give VB some problems.
    However thanks for help me.
    Bye
    Corzar


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

Featured