J
Joiko
Hi This two lines of code have always worked fine
System.Windows.Forms.Form ModificaPrenotazione = new
ModificaPrenotazione(id_preno);
ModificaPrenotazione.Show();
But, after some changes to the logics in the ModificaPrenotazione Form
(Changes like new button, new buttons event, etc..) , the method show()
throws this execption "ObjectDisposedException was unhandled" Cannot
access a disposed object
What have I done to my code to make it doesn't work?? why was it
working fine and now it doesn't work?
How can I resolve this problem??
Exception details:
System.ObjectDisposedException was unhandled
Message="Cannot access a disposed object.\r\nObject name:
'ModificaPrenotazione'."
Source="System.Windows.Forms"
ObjectName="ModificaPrenotazione"
StackTrace:
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.Show()
at
AnyHotel.ResocontoStanzaUserControl.b_MouseClick_VisualizzaPrenotazione(Object
sender, MouseEventArgs e) in C:\Documents and
Settings\Lavoro\Documenti\Visual Studio
2005\Projects\AnyHotel\AnyHotel\ResocontoStanzaUserControl.cs:line 233
at System.Windows.Forms.Control.OnMouseClick(MouseEventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at AnyHotel.Program.Main() in C:\Documents and
Settings\Lavoro\Documenti\Visual Studio
2005\Projects\AnyHotel\AnyHotel\Program.cs:line 17
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
System.Windows.Forms.Form ModificaPrenotazione = new
ModificaPrenotazione(id_preno);
ModificaPrenotazione.Show();
But, after some changes to the logics in the ModificaPrenotazione Form
(Changes like new button, new buttons event, etc..) , the method show()
throws this execption "ObjectDisposedException was unhandled" Cannot
access a disposed object
What have I done to my code to make it doesn't work?? why was it
working fine and now it doesn't work?
How can I resolve this problem??
Exception details:
System.ObjectDisposedException was unhandled
Message="Cannot access a disposed object.\r\nObject name:
'ModificaPrenotazione'."
Source="System.Windows.Forms"
ObjectName="ModificaPrenotazione"
StackTrace:
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.Show()
at
AnyHotel.ResocontoStanzaUserControl.b_MouseClick_VisualizzaPrenotazione(Object
sender, MouseEventArgs e) in C:\Documents and
Settings\Lavoro\Documenti\Visual Studio
2005\Projects\AnyHotel\AnyHotel\ResocontoStanzaUserControl.cs:line 233
at System.Windows.Forms.Control.OnMouseClick(MouseEventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at AnyHotel.Program.Main() in C:\Documents and
Settings\Lavoro\Documenti\Visual Studio
2005\Projects\AnyHotel\AnyHotel\Program.cs:line 17
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()