Suppose we have to input data for date of birth. Let we say 11/23/1998 (mm/dd/yyyy). In practice we have to input 11 then we have to input / and so on. I wish to know whether it is possible when we input 11 display will be 11/ that means / will automatically come with 11.
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.Write("DOB mm/dd/yyyy ");
string s = Console.ReadLine();
Console.ReadKey();
}
}
}
Loading
VulpesPosted Feb 21, 2012, 6:15 PM
In fact, if you're going to do that you might as well validate the date as the user enters it at the same time.
The following, if I've written it correctly, should beep and refuse to accept invalid input as well as automatically inserting the forward slashes:
Prime bPosted Feb 21, 2012, 6:28 PM
Posted Feb 21, 2012, 6:27 PM
I will go through step by step and get back if I have any problem.