Results 1 to 14 of 14

Thread: [RESOLVED] Object Disposed Exception - Multiple Forms

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    26

    Resolved [RESOLVED] Object Disposed Exception - Multiple Forms

    Hey Guys,

    I am using VB 2008 Express Edition.

    I have an app that has 2 forms (will be adding more). Button click on form1 opens form 2. The first time I run my app everything works fine, but when I click the close 'X' button on form 2 and try opening form 2 again by clicking the button on form 1, VB throws a Object Disposed Exception, Cannot access a disposed object

    Here is my code on form 1

    Code:
    Public Class frmMain
        Dim myForm As Form3
        Private Sub btnWeld1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWeld1.Click
            If IsDisposed Then Return
            If myForm Is Nothing Then
                myForm = New Form3
            End If
    
            myForm.Show()
        End Sub
    
    End Class
    Can you tell me how to fix this problem.

    Thanks,
    Novice_User
    Last edited by Vb_Novice_User; Jan 21st, 2010 at 12:54 PM.

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