Hi, I tried to Disable a button while all the textfield is null or empty, but it only work with one text box. If I type something into any text box, the button enable. I want the button to be disable until all textbox are fill with something. Thank you.
Here is my original code from Visual Studio.
I also tried to
Here is my original code from Visual Studio.
private void Textbox_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(((TextBox)sender).Text))
okButton.Enabled = false;
else
okButton.Enabled = true;
}
I also tried to
private void Textbox_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textbox1.text) && string.IsNullOrEmpty(textbox2.text) )// I added && to all the text box, but it still gave me the same result.
okButton.Enabled = false;
else
okButton.Enabled = true;
}