for my program i'm writing i want to ask for a name and if the input has a number or other unwanted input to loop back and do it again.
This is my current code
private void gameForm_Load(object sender, EventArgs e)
{
string value = "Type here";
if (globalVariables.InputBox("Name", "Please enter name", ref value) == DialogResult.OK)
{
name = value;
if (name.All(char.IsLetter))
{
lblName.Text = value;
}
else
{
}
}
}
How can i re-run this code if invalid input is present?