none
Disabling Submit button until all fields are filled - How to

    Question

  •  

    Hello everyone,

    How do I disable a submit button until all controls are filled?

    Is there a way to do this without adding conditional statements to each controls?

     

    Thanks everyone!

     

    BL

    Wednesday, March 23, 2011 2:14 AM

Answers

  • Create a sub called Validate, and call it on every control_Changed event.

    In the proc, check the values for all controls;

    if one of them is not ok, leave the button disabled,

    if all are ok, enable the button.

    May I say that this strategy is good if you have one or two controls on your dialog,

    but it becomes counter-intuitive if there are more; the user has to guess in which control he made an error.

    It is generally better to leave the button enabled, and validate in the click event.

    Wednesday, March 23, 2011 8:35 AM