Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best Placement of Code
Message
De
09/04/2021 11:44:15
 
 
À
08/04/2021 07:39:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01679489
Message ID:
01679722
Vues:
102
Thank you Tamar et al. Appreciate it greatly. I will look into those options suggested.


>Thanks for the response. The struggle i have with applying that approach is that i have a base class for all my texboxes some of which do not need validation applied (i.e. email address phone number etc). So how do I fire it off only for those that need the validation code to apply to?
>I thought about setting up a custom class called chckThisBox ( true or false ), and placing that flag in the valid method of the textox (not the class). then once the base class valid method calls the validation method, first thing it looks for IF chckThisbox equals TRUE then proceed with the check.....thoughts on that methodology???
>

Basically, for stuff like this, you have two options. One is to use a flag property to indicate whether a particular condition exists. That approach has the advantage that controls using the class can easily be changed from one case to the other.

The alternative is to have a subclass specifically to handle the case. The advantage there is not carrying the extra code around where you don't need it.

Each approach is appropriate in some cases. In this case, I'd probably add a logical property to the base textbox class and let it determine whether to run this particular validation code. I'd also probably put the validation code itself in a custom method and call that method when the flag is set.

Tamar
Thanks in Advance.

J. Turner
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform