Pause a Console Application for User Input or Pause Command in a Console Application
While working with C# or VB.NET Console Applications, you may require to pause for the user input or display a message to the user. Console application window get exit as the program execution finished. Following Piece of code will do it for you.
C#.NET
using System;
using System.Collections.Generic;
using System.Text;
namespace Pause {
class Program {
static void Main(string[] args)
{
Console.WriteLine("Press any key to continue…");
Console.ReadLine(); //Pause
}
}
}
VB.NET
Imports System
Imports System.Text
Module Module1
Sub Main()
Console.WriteLine("Press any key to continue…")
Console.ReadLine()
End Sub
End Module





Comments
No comments yet.
Leave a comment