Hello there. I'm a bit new to .Net and its very different from vb6. Well, Ive set an mdi container, and created another form which is supposed to be the child. But since u cant call a form like that, u have to create an instance of it everytime.
I wanted to create an instance of a form, and use this form throughout the application.
Ive added a class (clsForms)put the following code:
So each time I need that form, I just call
Now making this form a child, I've added a menu in my Mdi and call the child like that:
It works great. But after closing the child(myForm) and clicking on the menu again, the child was supposed to show again, but instead, i get the following error:
Is there a way to make a form available globally (creating an instance of it and use it everytime) instead of creating a new instance everytime?
Thanks.
I wanted to create an instance of a form, and use this form throughout the application.
Ive added a class (clsForms)put the following code:
Code:
Public shared myFrom as new Form1
So each time I need that form, I just call
Code:
clsForms.myForm.Show
Now making this form a child, I've added a menu in my Mdi and call the child like that:
Code:
clsForms.myForm.mdiparent=me
clsforms.myform.show
It works great. But after closing the child(myForm) and clicking on the menu again, the child was supposed to show again, but instead, i get the following error:
Code:
An unhandled exception of type 'System.ObjectDisposedException' occurred in system.windows.forms.dll
Additional information: Cannot access a disposed object named "Form1".
Is there a way to make a form available globally (creating an instance of it and use it everytime) instead of creating a new instance everytime?
Thanks.