-1

I am having a first time exception error when I run my code and I can not figure out why. I am very new to Visual Studio and I can not figure out what I am doing wrong.

Since I do not have enough points to post an image, this is the beginning of the error:

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)

Does anyone have any idea what is causing this error and how I could fix this?

Kara
  • 6,115
  • 16
  • 50
  • 57

1 Answers1

0

"Form that is already visible cannot be displayed as a modal dialog box"

that says it already. it seems you are trying to show the actual form (where the button is placed) or another existing form as a modal form. You can't.

Mirco Ellmann
  • 983
  • 7
  • 8
  • Can you explain to me what a modal dialog box is? I'm very new to Visual Studio, so I do not know what this is. I am trying to create a form where you first login, and then you are shown another form with other forms that you can click on. – danieltisdale May 04 '13 at 21:58
  • In easy words: a modal dialog box is a form you first have to close before you can focus another form. The form you want to show must be invisible when you call ShowDialog. – Mirco Ellmann May 04 '13 at 22:04
  • So, if I were to change all of the "showdialog" to "show", would this fix the problem? For example, if I am trying to open a new form from a click, then I would type something like, "me.close() me.dispose() frmOrders.show()" ??? – danieltisdale May 05 '13 at 00:00