我运行代码时出现第一次异常错误,我无法弄清楚原因。我是Visual Studio的新手,我无法弄清楚我做错了什么。
由于我没有足够的点来发布图像,这是错误的开始:
A first chance exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>Project Starter.vshost.exe</AppDomain><Exception><ExceptionType>System.InvalidOperationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Form that is already visible cannot be displayed as a modal dialog box. Set the form's visible property to false before calling showDialog.</Message><StackTrace> at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at Project_Starter.frmOrders.btnClose_Click(Object sender, EventArgs e) in F:\MIS 304\Homework\Project Starter\Project Starter\Project Starter\frmOrders.vb:line 70
at System.Windows.Forms.Control.OnClick(EventArgs e)
有没有人知道导致此错误的原因以及我如何解决此问题?
答案 0 :(得分:0)
“已显示的表单无法显示为模式对话框”
已经说过了。似乎你试图显示实际的形式(放置按钮的位置)或另一个现有的形式作为模态形式。你不能。