Instance of an form

  • Thread starter Thread starter krishna
  • Start date Start date
K

krishna

Hi,
I have doubt,I have a MDI form with few menus
whenever i click on particular menu item it should
open.it is opening nice.I have closed that form.I am still
in the MDI i have tried to open the same form.It is giving
error message disposed object can not exist.I have
declared the form instances in the module.

Regards,
Krishna.
 
Hi,

When you closed the form the form variable was disposed. Try
something like this.

if MyFormVariable is nothing then
MyFormVairable = new MDIChildForm
End If

' Show your form here and add to the mdiparent form

Ken
--------------------
Hi,
I have doubt,I have a MDI form with few menus
whenever i click on particular menu item it should
open.it is opening nice.I have closed that form.I am still
in the MDI i have tried to open the same form.It is giving
error message disposed object can not exist.I have
declared the form instances in the module.

Regards,
Krishna.
 
Once the form is closed, it is disposed and you need to create a new
instance.

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
 
krishna said:
I have doubt,I have a MDI form with few menus
whenever i click on particular menu item it should
open.it is opening nice.I have closed that form.I am still
in the MDI i have tried to open the same form.It is giving
error message disposed object can not exist.I have
declared the form instances in the module.

Add this to your menu item's 'Click' event handler:

\\\
Dim f As New Form1()
f.Show()
///

This will create a new instance of your for every time the item is clicked.
 
i understand ur proiblem. try my example :
use keypwrd NOTHING and IsDisposed

in ur menu
\\
\\
Case "Server's status"
If netBots.nStatus Is Nothing OrElse
netBots.nStatus.IsDisposed Then
netBots.nStatus = New frmStatus
End If
netBots.nStatus.MdiParent = Me
netBots.nStatus.Show()

u can close it and open again
regards
 
Back
Top