Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Validating data in grid entry
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00678737
Message ID:
00678924
Vues:
23
Hello Douglas.

I want to only allow the user to leave a grid line in a form, if what they entered is valid. I have the code for validity checking, but don't understand how to code the valid method so it won't allow them to leave the grid line.

Actually, if you are using VFP version 7.0 it is even easier than the code BNadya gave you. I wrote that code for VFP version 6 before they added the RowColChange property to the grid. Now this is all you need in the grid's BeforeRowColChange():
WITH This
  IF INLIST( .RowColChange, 1, 3 )
    *** If we are trying to move to a new row
    *** validate the current row
    IF NOT EOF( .RecordSource ) AND RECCOUNT( .RecordSource ) > RECNO( .RecordSource )  
      *** Do not allow the move if the validation fails
      IF .ValidateCurrentRow()
        *** peachy keen go ahead and move off the row
      ELSE
        NODEFAULT
      ENDIF	
    ENDIF
  ENDIF
ENDWITH
ValidateCurrentRow is a template method and the validation code goes in the instance on the form. The nice thing about doing it this way is that all the logic goes into my data entry grid class and the only thing I have to write in the instance is the actual validation.

HTH
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform