Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Validate Textbox value?
Message
De
15/04/2003 15:43:59
Jason Mesches
Ocean Systems Engineering Corporation
Carlsbad, Californie, États-Unis
 
 
À
15/04/2003 15:06:03
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Divers
Thread ID:
00777948
Message ID:
00777996
Vues:
10
Hello Amanda,

I would suggest not sticking your code at all, at least not in your form. Remember, any code you put in a form might as well have the following header:
**Amanda's oh-so-cool code that goes bye-bye when she eventually ports this project to the web!!
I would create a rules object, CalInfoRulesObj, adding a few methods to test the validity of the data entered. Then, in the Valid() of each TextBox -- as Alan suggested -- call directly to those new methods...
***Your BeginDateTextBox.Valid()
ldBegin = This.Value
ldEnd = EndDateTextBox.Value

loCalInfoObj = ThisForm.RefBizObj.Get('CalInfoBizObj')
loCalInfoObj.oBizRules.ValidateBeginDate(ldBegin, ldEnd) && Create a separate one for your end date validation to call from that textbox's Valid()

IF loCalInfoObj.oBizRules.GetCount() # 0
   MESSAGEBOX('Summer begin date must be greater than the regular term end date.', 48, 'Summer begin date error')
   this.Value = v_calinfo.dregend + 1
ENDIF
Now you have rules you can call from anywhere, including COM, so you won't have to re-write it. Reusability... it's not just for breakfast anymore!
---J

>Ok, it is stupid question of the week time. I have (2) Begin date and End date text boxes. The (B)Begin date text box value cannot be greater than the (A) End Date text box. (How can you start a new date range when the other hasn't completed yet?) Here is what I need to do, when the user types in a value into the (B) Begin Date, I want to check that the value is greater than that view value used to populate (A) End Date. I have the correct code to check, but my problem is what text box method to put it in. I tried InteractiveChange, and LostFocus, but they only work sporadically. What am I doing wrong? So, where do I stick it? <vbg>
>
>if this.Value > v_calinfo.dregend
> messagebox('Summer begin date must be greater than the regular term end date.', 48, 'Summer begin date error')
> this.Value = v_calinfo.dregend + 1
>endif
>

>TIA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform