473,396 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Instance of an form

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.
Nov 21 '05 #1
6 1054
Krishna,

With MDI forms I use this one from what I have made a sample in this
message.

http://groups-beta.google.com/group/...bfdc42fec49419

Maybe it helps you to, the disadvantage is that there is only one type of
midi form active, however that is exactly as I want.

I hope this helps?

Cor
Nov 21 '05 #2
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
--------------------
"krishna" <ve*************@gmail.com> wrote in message
news:0d****************************@phx.gbl...
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.
Nov 21 '05 #3
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" <ve*************@gmail.com> escribió en el mensaje
news:0d****************************@phx.gbl...
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.

Nov 21 '05 #4
"krishna" <ve*************@gmail.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #5
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

krishna wrote:
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.


Nov 21 '05 #6
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

krishna wrote:
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.


Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Yasutaka Ito | last post by:
Hi, As you know, all the non-ui components (like Timer control, etc.) that sit on the form are contained in its private variable 'components'. How can I enumerate such components from any form...
6
by: Dmitry Karneyev | last post by:
Hi! I guess this question have been asked a lot of times, but please be tolerant and if you have any ideas share it. The question is: how to make availibale only one instance of application and...
6
by: Max | last post by:
Last time I tried to explain this on another forum it didn't go too well, so I'll try my best and if you know what I'm talking about then please tell me how to do this. I have a class, inside I...
6
by: Shane Saunders | last post by:
I have a menu option that loads a form and displays infomation. if you go to main form and try to load something else from that same menu, it does a check to see if the form in exist and then...
8
by: kevin | last post by:
I have a form and in the form I have a sub that uses a class I instantiate using visual basic code: Public oCP As New Rs232 'instantiate the comm port I need to share this sub with...
4
by: Ryan | last post by:
I have some custom forms that contain their own properties and I call them as such: Dim myDialog As New myDialogForm myDialog.mID = 1 ' sets the custom property mID to 1...
0
by: Miro | last post by:
I searched google and I think I have solved the issue. Again, if someone could quickly skim over my example and lemmi know if it is the "correct" way of doing things. It works, but again - is it...
3
by: Mark Jerde | last post by:
VS 2005. When I google "CSharp single instance form" the returned pages usually use a Mutex or the VB.NET runtime library....
3
by: Jon | last post by:
My main form opens up another form, and from this other form, I'd like to access things in the main form. The problem is that although I know the name of the class of the main form (FormMain) I...
7
by: =?Utf-8?B?TWF0dA==?= | last post by:
Hi I have an app that runs without a main form, just a notification icon, when the user clicks the icon the form is shown, and when the form is minimized it's hidden. This all works great,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.