c# how to display next WriteLine after pressing a key

191 Views Asked by At

Basically in my code I want it to display the next lines after the user presses a key. I thought it was ReadKey, but after I press a key it closes.

For Example

WriteLine("Press any key to display invoice...");
ReadKey(); //this part

WriteLine("***************************");
WriteLine("***  Corporation ***");
WriteLine("Customer Invoice \r\n");
WriteLine("SHIP TO: ");
1

There are 1 best solutions below

0
On BEST ANSWER

You need another ReadKey before the program ends

Console.WriteLine("Press any key to display invoice...");
Console.ReadKey(); //this part

Console.WriteLine("***************************");
Console.WriteLine("***  Corporation ***");
Console.WriteLine("Customer Invoice \r\n");
Console.WriteLine("SHIP TO: ");

// if you dont do this, the program ends and you cant see the other lines
Console.ReadKey();