Results 1 to 4 of 4

Thread: Mind Boggling Question!!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    154

    Mind Boggling Question!!

    Hey everyone,

    I've been trying for almost 4 hours to get this working...and still no success. So I figured I would see if there was any help for the problem!

    So here it is.

    I've created this little test program. There very first time you run the program after it's created it actually works!

    But if you stop it and then run it again, it throws an exception!

    So when you click the button once to open the new form, it opens it. then close the form and click the button again and it throws an exception. But the very first time you run this program after it is created this actually works perfect.

    Now here is the second catch. Run the program again. This time click the button 2 times, then close the form. Then click the button again, and it actually works.

    So there it is.......thanks in advance for the help!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314
    When you clise the Child form the instance of your public form variable is disposed, so this shouldn't work I guess. Don't ask me why it works the first time though..... Try something like this as an approach instead.....

    Code:
    Dim frm As Form
    For Each frm In Me.MdiChildren
        If TypeOf (frm) Is Form2 Then
            frm.BringToFront()
            Exit Sub
        End If
    Next
    Dim myForm As New Form2()
    myForm.MdiParent = Me
    myForm.Show()

  3. #3
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    154
    Thanks alot man. That does exactly what I needed it to do.

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