Enabling Button when All Textboxes have information in them.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good Day

I am new at this programming thing but I thought I would give Windows Forms
a shot.

I have a form that has 3 text boxes on it and a button which is Disabled by
default in the properties. I want to "enable" the button when there is text
in the 3 textboxes.

Is there a property or something on the text boxes so I can enabled that
button when there is text in the boxes? You know like an OnUpdate or
OnChange??
 
You can use the TextChanged event.

private void textBox1_TextChanged(object sender, System.EventArgs e)
{
button1.Enabled = (textBox1.Text.Trim() !="");
}
 
Back
Top