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() !="");
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top