I am having trubble finding a way that works and helps to catch an error input. I need to handle if the input is not a 1 or a 2. Like . or a – or just any letter. I have tried catch and well nothing seems to work :/
Someone that have an idea for me to try? I am greatfull for any suggestions!! Thx in advance!
Regards
The code i have written so far looks like this:
console.WriteLine();
Console.Write("Make your choice: ");
int myinput = int.Parse(Console.ReadLine());
if (myinput == 1)
{
FirstEvent();
}
if (myinput == 2)
{
SecondEvent();
}
Usually we use the TryParse methods