title: textbox Empty validation
body: <p>I'm trying to validate a text box in a form to not having empty string if the user didn't entered anything in the text box, so if the text box was empty, the user has to enter a value ,and my code was like this, but it is not working</p>
  
  <pre><code>  public int TextBox_Validation(string sender)
    {
  
  
        try
        {
  
            if (string.IsNullOrEmpty(sender))
            {
                MessageBox.Show("Please enter a value");
            }
  
        }
        catch
        {
            int num = int.Parse(sender);
            return 0;
  
        }
        return 0;
    }
  </code></pre>