locked
how do I make the output stay on the screen?

    Question

  • Hello, when I run the program the output displays for a sec then disappears? How do I make it stay?

    namespace HelloWorld

     {

        class Program

         {

                static void Main(string[] args)

                {

                 System.Console.WriteLine("Hello World!");

                }

         }

    }

    Thursday, August 10, 2006 12:27 AM

Answers

  • System.Console.ReadChar() ( from memory, intellisense will fix it if you just type Read, there are three options from memory ).  Put that at the end of your program.

     

              static void Main(string[] args)

                {

                 System.Console.WriteLine("Hello World!");

                System.Console.ReadChar();

                }

    Thursday, August 10, 2006 2:43 AM
  • In visual C# 2005 Express Edition there is a special button for your problem on the toolbar. But by default this button isn't visible.

    Go to 'Tools' -> 'Customize'. Click on the tab named 'Command'. There you will see different categories and their commands. Select the 'Debug' categorie. From the command list select the 'Start without debugging' command en drag it to your toolbar.

    Now run your application by pressing the button you just added to your toolbar, or hit CTRL + F5.

    Thursday, August 10, 2006 11:18 AM

All replies

  • System.Console.ReadChar() ( from memory, intellisense will fix it if you just type Read, there are three options from memory ).  Put that at the end of your program.

     

              static void Main(string[] args)

                {

                 System.Console.WriteLine("Hello World!");

                System.Console.ReadChar();

                }

    Thursday, August 10, 2006 2:43 AM
  • In visual C# 2005 Express Edition there is a special button for your problem on the toolbar. But by default this button isn't visible.

    Go to 'Tools' -> 'Customize'. Click on the tab named 'Command'. There you will see different categories and their commands. Select the 'Debug' categorie. From the command list select the 'Start without debugging' command en drag it to your toolbar.

    Now run your application by pressing the button you just added to your toolbar, or hit CTRL + F5.

    Thursday, August 10, 2006 11:18 AM
  • Thank you dude it worked. The intell corrected the line to System.Console.ReadKey();

     

    Thursday, August 10, 2006 11:05 PM
  • Thankyou sir.  I would not have discovered that command my self.
    Thursday, August 10, 2006 11:06 PM
  • but how come  running that program in debug mode or not is affecting the display?
    Saturday, August 12, 2006 12:41 AM