... 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의 보낸 사람) InTransit = 진정한 있는 MsgBox ("모든 메시지") sender.Close() fMain.Show() 최종 하위 – rai