2
我得到具有堆栈跟踪误差...System.ObjectDisposedException:无法访问已处理的对象 - 为什么发生?
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Button'.
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.PointToScreen(Point p)
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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
产生这个错误代码是....
Friend Sub GoHome(ByVal sender As Form)
InTransit = True
sender.Close()
fMain.Show()
End Sub
它不给错误,当我刚刚切换的顺序在.show和.close方法
Friend Sub GoHome(ByVal sender As Form)
InTransit = True
fMain.Show()
sender.Close()
End Sub
能否请你告诉我,为什么在第一种情况下提示错误,为什么在第二种情况下它不?
更多有趣的信息...。 我只在应用程序被虚拟化时发生(Citrix) 如果它运行在同一台计算机上,它就不会发生。 当代码包含消息框时,它不会给出错误。 此代码工作正常,没有任何错误... 朋友小组GOHOME(BYVAL发件人为表) 途=真 MSGBOX(“任何消息”) sender.Close() fMain.Show() 完子 – rai 2012-02-16 15:40:20