View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_2_] Dave Peterson[_2_] is offline
external usenet poster
 
Posts: 420
Default Validating multiple textboxes on a form.

ps.

If you decide that you have too many textboxes of each type, you could create
those error message labels for each validity check you need for each of the
several class modules you need.

Then each class module will have to check all the labels to see if the
Ok/Next/Previous button should be enabled.



On 08/26/2010 15:52, Dave Peterson wrote:
I'm not sure what the best approach would be.

I'd start by creating another class module for the textboxes that contain 1-100.
But that means that they should be named nicely, too.

Well, if the number of these textboxes is small, I'd just validate each with its
own _change event.

And maybe add a label to hold an error message if there are no items in the
group of 5 textboxes. In fact, you could name all the error message labels
nicely so that you could use them as an indicator when the Ok button should be
enabled.

You'd just check all the labels looking for some string different from "". If
you find one, the ok button is disabled.

===
And if you don't want the user to advance to the next page when there's an
error, you'll have to use that same kind of technique.

Since you didn't say that you were building something like a wizard, I just
enabled/disabled the ok button.



On 08/26/2010 15:35, noname wrote:
<<snipped
Questions:
--------------

1] Do i need to create another class for this page controls? what
parts do i need to modify inorder to incorporate the individual
validations for textboxes (e.g. 1 to 100, 0 to 100 etc)

2] Again, do i have to add some additional code to Form_Initialize,
just like the one you showed before?

3] i am selecting pages, by clicking a button on 1st page, which
selects 2nd page. Similarly i am clicking a button on 2nd page, which
selects the 3rd page. Do i have to Enable / Disable these buttons
(just like your CommandButton OK) as per the Error messages made by
incorrect or incomplete entries in the textboxes?

Your help would be most appreciated!

Thanks& Best regards.



--
Dave Peterson