begin process at 2012 02 13 06:04:08
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Tutoriaux

 > VALIDATION FORMULAIRE

VALIDATION FORMULAIRE


 Information sur la source

Note :
Aucune note
Catégorie :Tutoriaux Niveau :Débutant Date de création :07/06/2002 Date de mise à jour :07/06/2002 16:49:39 Vu / téléchargé :5 416 / 340

Auteur : xvanneste

Ecrire un message privé
Site perso
Commentaire sur cette source (1)
Ajouter un commentaire et/ou une note

 Description

Petit code afin de reviser ou d'apprendre comment on valide des données entrées dans un formulaire

Source

  • Private Sub txtName_KeyPress(KeyAscii As Integer)
  • KeyAscii = Asc(UCase(Chr(KeyAscii)))
  • End Sub
  • Private Sub txtNumDays_KeyPress(KeyAscii As Integer)
  • If Chr(KeyAscii) = vbBack Or Chr(KeyAscii) = "-" Or Chr(KeyAscii) = "(" Or Chr(KeyAscii) = ")" Then Exit Sub
  • If Not IsNumeric(Chr(KeyAscii)) Then
  • Beep
  • KeyAscii = 0
  • staAdditionalInfo.Panels("addInfo").Text = "Valeur numerique uniquement."
  • End If
  • End Sub
  • Private Sub txtNumDays_LostFocus()
  • If MaskEdBox1.ClipText <> "" And txtNumDays.Text <> "" Then
  • txtCheckOut.Text = Format(DateAdd("d", Val(txtNumDays.Text), MaskEdBox1.Text), "dd-mm-yyyy")
  • End If
  • End Sub
  • Private Sub txtNumPeople_KeyPress(KeyAscii As Integer)
  • If Chr(KeyAscii) = vbBack Or Chr(KeyAscii) = "-" Or Chr(KeyAscii) = "(" Or Chr(KeyAscii) = ")" Then Exit Sub
  • If Not IsNumeric(Chr(KeyAscii)) Then
  • Beep
  • KeyAscii = 0
  • staAdditionalInfo.Panels("addInfo").Text = "Valeur numerique uniquement."
  • End If
  • End Sub
  • Private Sub txtPhone_KeyPress(KeyAscii As Integer)
  • If Chr(KeyAscii) = vbBack Or Chr(KeyAscii) = "-" Or Chr(KeyAscii) = "(" Or Chr(KeyAscii) = ")" Then Exit Sub
  • If Not IsNumeric(Chr(KeyAscii)) Then
  • Beep
  • KeyAscii = 0
  • staAdditionalInfo.Panels("addInfo").Text = "le numero de téléphone est numerique."
  • End If
  • End Sub
Private Sub txtName_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub txtNumDays_KeyPress(KeyAscii As Integer)
    If Chr(KeyAscii) = vbBack Or Chr(KeyAscii) = "-" Or Chr(KeyAscii) = "(" Or Chr(KeyAscii) = ")" Then Exit Sub
    If Not IsNumeric(Chr(KeyAscii)) Then
        Beep
        KeyAscii = 0
        staAdditionalInfo.Panels("addInfo").Text = "Valeur numerique uniquement."
    End If

End Sub

Private Sub txtNumDays_LostFocus()
    If MaskEdBox1.ClipText <> "" And txtNumDays.Text <> "" Then
        txtCheckOut.Text = Format(DateAdd("d", Val(txtNumDays.Text), MaskEdBox1.Text), "dd-mm-yyyy")
    End If
End Sub

Private Sub txtNumPeople_KeyPress(KeyAscii As Integer)
    If Chr(KeyAscii) = vbBack Or Chr(KeyAscii) = "-" Or Chr(KeyAscii) = "(" Or Chr(KeyAscii) = ")" Then Exit Sub
    If Not IsNumeric(Chr(KeyAscii)) Then
        Beep
        KeyAscii = 0
        staAdditionalInfo.Panels("addInfo").Text = "Valeur numerique uniquement."
    End If

End Sub

Private Sub txtPhone_KeyPress(KeyAscii As Integer)
    If Chr(KeyAscii) = vbBack Or Chr(KeyAscii) = "-" Or Chr(KeyAscii) = "(" Or Chr(KeyAscii) = ")" Then Exit Sub
    If Not IsNumeric(Chr(KeyAscii)) Then
        Beep
        KeyAscii = 0
        staAdditionalInfo.Panels("addInfo").Text = "le numero de téléphone est numerique."
    End If
End Sub


 Conclusion

ceci est un exemple qui permet de se familiariser avec la validation au niveau champ ou au niveau feuille

 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

Source avec Zip JACKPOT

 Sources de la même categorie

Source avec Zip DLL PERSONNALISÉ AVEC ÉVÈNEMENTS ET PROPRIÉTÉS EN VB6. par Number7
Source avec Zip Source .NET (Dotnet) EXEMPLE DU TUTORAIL "CLASSES MÉTIER" par Adn56
Source avec Zip Source avec une capture Source .NET (Dotnet) GESTION DES LISTES : RANGEMENT (LIST.SORT) ET FILTRAGE (LIST... par kbalist
Source avec Zip EXEMPLE SUR LES MENUS POUR AIDER LES DÉBUTANTS COMME MOI ;-) par viragoloco
LES OPÉRATIONS DE LA LISTE CHAINÉE par smaili

Commentaires et avis

Commentaire de noe le 07/06/2002 18:06:00

bonjour

petit sousis message "remplissez touts les champs"
mais le champ date de départ non accesible

a+

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 1,248 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales