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