KentDBerry
asked on
ObjectDisposedException error
On my main form, I have a menu item that calls the below code. In the Sub New() of the form, I call a login form that determines permissions of user on that form. However, if the user presses the cancel button on the login form, the login form will close and so will the below frm. And I get an ObjectDisposedException error on the line fmr.ShowDialog(). (i.e. Cannot access a disposed object).
What do I need to to do to work around this errror. I was hoping the Try Catch statement would trap the error but it does not.
What do I need to to do to work around this errror. I was hoping the Try Catch statement would trap the error but it does not.
Private Sub UserMaintenanceToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UserMaintenanceToolStripMenuItem.Click
Try
Dim frm As frmUsersMaintenance = New frmUsersMaintenance
frm.ShowDialog()
Catch ex As Exception
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
It seems to me that you may need to work out your events esp. if your calling form Close event before doing other things.