VS Run Window Disappears

Kenneth Burton 1 Reputation point
2021-01-26T16:08:46.773+00:00

VS C# I am brand new to VS and am doing the database application tutorial in C#. I have worked through to step 9 and it runs without errors, but I never see the actual application window. It flashes and disappears. What did I miss that would keep the window active so I can see it? Thanks Ken

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,648 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
967 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Alberto Poblacion 1,556 Reputation points
    2021-01-26T21:27:07.523+00:00

    Is it a Console application?

    It will not disappear if you use "Run without debugging" instead of "Run".

    Another option is to open a command window from the operating system, and then launch your program's executable from the command Window.

    Finally, my favorite option is to edit the source code and add the following lines at the end of the main() method:

    if (System.Diagnostics.Debugger.IsAttached)
    {
        Console.WriteLine("Press ENTER to exit");
        Console.ReadLine();
    }
    
    0 comments No comments

  2. Kenneth Burton 1 Reputation point
    2021-01-26T22:13:47.057+00:00

    This is the tutorial that I was working on: https://learn.microsoft.com/en-us/visualstudio/ide/step-9-review-comment-and-test-your-code?view=vs-2019

    It is a Windows Forms App.

    I did try Ctrl-F5 (run without debugging) and it did the same thing.

    I will try your lines in my code.

    Thank you,
    Ken