J
Jack Fu
I want to make sure the user enters a number (rather than
a letter, for example). This is the way I am doing it. There
must be a better, more efficient way. Can someone please
tell me the better way? Thanks in advance!
Jack
Console.Write("\nEnter the ID number : ");
tempInput = Console.ReadLine();
try
{
checked
{
valueID = int.Parse(tempInput);
}
}
catch (Exception e)
// I don't know why this word (catch) gets squiggly line.
// It compiles and runs ok.
{
Console.WriteLine(" You must enter a number for the ID.");
goto WRITE_MENU;
}
Inventory[recordCount].ID = valueID;
a letter, for example). This is the way I am doing it. There
must be a better, more efficient way. Can someone please
tell me the better way? Thanks in advance!
Jack
Console.Write("\nEnter the ID number : ");
tempInput = Console.ReadLine();
try
{
checked
{
valueID = int.Parse(tempInput);
}
}
catch (Exception e)
// I don't know why this word (catch) gets squiggly line.
// It compiles and runs ok.
{
Console.WriteLine(" You must enter a number for the ID.");
goto WRITE_MENU;
}
Inventory[recordCount].ID = valueID;