title: Enable disable button on text changed in c# winform
body: <p>I am developing an application, in which there is a button in search box (like one in itunes).
  I want to enable cancel button whenever there is text in text box and disable it when text box is empty.
  I tried with text_changed event on textbox with the following code, but it jump over the if condition. Even sender sends me correct values but i am unable to put it into if else.</p>
  
  <pre><code>private void textBox1_TextChanged(object sender, EventArgs e)
      {
          if (string.IsNullOrEmpty(sender.ToString()))
          {
              btn_cancel.Visible = false;
          }
          else
          {
              btn_cancel.Visible = true;
          }
      }
  </code></pre>
  
  <p>Please help</p>