Hi dpotter,
You can use a Validate function like
private void Validate()
{
// where txtBox1, txtBox2, txtBox3
// refers to your textboxes
// if any of them is empty return false
if (txtBox1.Text==String.Empty !! txtBox2.Text==String.Empty !! txtBox3.Text==String.Empty !!)
{
btnYourButton.Enabled = false;
}
btnYourButton.Enabled = true;
}
You have to fire this in a common event of your textboxes' KeyUp event.
But if you ask me, make your button enable and use this function at your
button's click event like:
private boolean Validate()
{
// where txtBox1, txtBox2, txtBox3
// refers to your textboxes
// if any of them is empty return false
if (txtBox1.Text==String.Empty !! txtBox2.Text==String.Empty !! txtBox3.Text==String.Empty !!)
{
return false;
}
return true;
}
and in click event you can use like this:
// your click event
private void btnYourButton_OnClick(....)
{
if(Validate())
{
// Do your procedures
}
else
{
MessageBox.Show("Fill all the required fields");
}
}
Because like this you are firing a event only one time, otherwise
every key up fires an event and it is not good..
Kind Regards..