Currently learning c#. Is there any way I could use a try-catch block on the code below instead of an if statement to validate user input?
string carID = txtCar.Text;
if (carID != "")
{
car1.car = carID;
}
else
{
MessageBox.Show("Please enter a car id e.g: ford");
}
Aucun commentaire:
Enregistrer un commentaire