i am validating my text box through the validating and validated events , below is my code
private void tbms_Validating(object sender, CancelEventArgs e)
{
if (tbms.Text.Length==0)
{
MessageBox.Show("Ms is Empty");
e.Cancel = true;
}
}
private void tbms_Validated(object sender, EventArgs e)
{
MessageBox.Show("No Error");
}
Its works nice , but the problem i am facing is if there is no text in text box and i want to close the application through the cancel button on control box its show me the message box that Ms is Empty and prompt me again to the window . when i put some text in text box and i click the cancel button the application closed. Kindly give hint how to solve this problem.Thanks in advance. Regards