I currently have an WinForm consisting of Name, Address, Zip Code, State, and Age.
Once the user inputs the data, they click the "Exit" button which confirms no fields are blank, then saves the data to a file. I want to add a Zip Code validation that confirms the textbox (ZipField) contains only numbers.
private void Btn_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(NField.Text) || String.IsNullOrEmpty(AField.Text) ||
String.IsNullOrEmpty(ZField.Text) || String.IsNullOrEmpty(SField.Text) ||
String.IsNullOrEmpty(AField.Text))
{
MessageBox.Show("Please complete", "Unable to save", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
saveInfo();
Form myForm = Start.getForm();
myForm.Show();
this.Close();
}