Multi Form on Windows form application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kief12
    New Member
    • Jul 2007
    • 13

    Multi Form on Windows form application

    I am trying to make an application that has a starting form and then if you click on a button it opens and another form. I am using VC++ and i create 2 new forms in it and used this to start the other form.
    Code:
    Application::Run(gcnew w_Name());
    It complies fine but gives me this run time error
    Code:
    An unhandled exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
    
    Additional information: Starting a second message loop on a single thread is not a valid operation. Use Form.ShowDialog instead.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Application::Ru n() starts a Windows program message loop.

    Only one of these loops is allowed per application. You can start a second application as a separate process but you can't start a process within a process.

    If you want a second process then call CreateProcess() from your first application. Otherwise, you will just create windows and forms using somerthing other than Application::Ru n().

    Comment

    Working...