begin process at 2012 02 16 19:36:51
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Date & Heure

 > UN CONTRÔLE HORLOGE BASIQUE

UN CONTRÔLE HORLOGE BASIQUE


 Information sur la source

Note :
5 / 10 - par 1 personne
5,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Date & Heure Niveau :Débutant Date de création :06/09/2003 Date de mise à jour :06/09/2003 11:53:38 Vu / téléchargé :3 477 / 421

Auteur : fbrt

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

 Description

Puisque je n'ai pas trouvé de Contrôle ActiveX pour l'heure (comme "Microsoft Calendar Control" pour la date), voici un ocx pour l'heure.

Personnalisez le selon vos besoins et vos préférences. Il n'y a pas beaucoup de propriétés (Hour et Minute) car c'est mon premier OCX.

Source

  • '----------------- Contrôles :
  • 2 textbox : Heure et minute (TxtHeure et txtMinute)
  • 4 command : HeurePlus, HeureMoins, MinutePlus, MinuteMoins
  • '----------------- Code :
  • Option Explicit
  • Private Sub HeureMoins_Click()
  • With TxtHeure
  • If .Text = "" Then
  • .Text = "0"
  • End If
  • If .Text = "0" Then
  • .Text = "23"
  • Else
  • .Text = .Text - 1
  • End If
  • End With
  • End Sub
  • Private Sub HeurePlus_Click()
  • With TxtHeure
  • If .Text = "" Then
  • .Text = "0"
  • End If
  • If .Text = "23" Then
  • .Text = "0"
  • Else
  • .Text = .Text + 1
  • End If
  • End With
  • End Sub
  • Private Sub MinuteMoins_Click()
  • With TxtMinute
  • If .Text = "" Then
  • .Text = "00"
  • End If
  • If .Text = "00" Then
  • .Text = "59"
  • Else
  • .Text = .Text - 1
  • End If
  • End With
  • Call Zero
  • End Sub
  • Private Sub MinutePlus_Click()
  • With TxtMinute
  • If .Text = "" Then
  • .Text = "00"
  • End If
  • If .Text = "59" Then
  • .Text = "00"
  • Else
  • .Text = .Text + 1
  • End If
  • End With
  • Call Zero
  • End Sub
  • Private Sub TxtHeure_Change()
  • Call VerifierHeure
  • End Sub
  • Private Sub TxtMinute_Change()
  • Call VerifierMinute
  • End Sub
  • Private Sub TxtMinute_KeyPress(KeyAscii As Integer)
  • If KeyAscii = 13 Then
  • Call Zero
  • End If
  • End Sub
  • Private Sub UserControl_Resize()
  • UserControl.Width = 3345
  • UserControl.Height = 1665
  • End Sub
  • Public Property Get Hour() As String
  • Hour = TxtHeure.Text
  • End Property
  • Public Property Get Minute() As String
  • Minute = TxtMinute.Text
  • End Property
  • Sub VerifierHeure()
  • If Not (IsNumeric(TxtHeure.Text)) Then
  • GoTo fin
  • End If
  • If TxtHeure.Text < 0 Then
  • GoTo fin
  • End If
  • If TxtHeure.Text > 23 Then
  • GoTo fin
  • End If
  • Exit Sub
  • fin:
  • MsgBox "Valeur incorrecte", vbCritical
  • TxtHeure.Text = "12"
  • End Sub
  • Sub VerifierMinute()
  • If Not (IsNumeric(TxtMinute.Text)) Then
  • GoTo fin
  • End If
  • If TxtMinute.Text < 0 Then
  • GoTo fin
  • End If
  • If TxtMinute.Text > 59 Then
  • GoTo fin
  • End If
  • Exit Sub
  • fin:
  • MsgBox "Valeur incorrecte", vbCritical
  • TxtMinute.Text = "00"
  • End Sub
  • Sub Zero()
  • If Len(TxtMinute.Text) = 1 Then
  • TxtMinute.Text = "0" & TxtMinute.Text
  • End If
  • End Sub
'----------------- Contrôles :

2 textbox : Heure et minute (TxtHeure et txtMinute)
4 command : HeurePlus, HeureMoins, MinutePlus, MinuteMoins



'----------------- Code :

Option Explicit

Private Sub HeureMoins_Click()

With TxtHeure

    If .Text = "" Then
        .Text = "0"
    End If

    If .Text = "0" Then
        .Text = "23"
    Else
        .Text = .Text - 1
    End If
    
End With

End Sub

Private Sub HeurePlus_Click()
   
With TxtHeure

    If .Text = "" Then
        .Text = "0"
    End If

    If .Text = "23" Then
        .Text = "0"
    Else
        .Text = .Text + 1
    End If
    
End With

End Sub

Private Sub MinuteMoins_Click()

With TxtMinute

    If .Text = "" Then
        .Text = "00"
    End If

    If .Text = "00" Then
        .Text = "59"
    Else
        .Text = .Text - 1
    End If
    
End With

Call Zero

End Sub

Private Sub MinutePlus_Click()

With TxtMinute

    If .Text = "" Then
        .Text = "00"
    End If

    If .Text = "59" Then
        .Text = "00"
    Else
        .Text = .Text + 1
    End If
    
End With

Call Zero

End Sub



Private Sub TxtHeure_Change()
    Call VerifierHeure
End Sub

Private Sub TxtMinute_Change()
    Call VerifierMinute
End Sub

Private Sub TxtMinute_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        Call Zero
    End If
End Sub

Private Sub UserControl_Resize()
    UserControl.Width = 3345
    UserControl.Height = 1665
End Sub



Public Property Get Hour() As String
    Hour = TxtHeure.Text
End Property


Public Property Get Minute() As String
    Minute = TxtMinute.Text
End Property


Sub VerifierHeure()
    
    If Not (IsNumeric(TxtHeure.Text)) Then
        GoTo fin
    End If
    
    If TxtHeure.Text < 0 Then
        GoTo fin
    End If
    
    If TxtHeure.Text > 23 Then
        GoTo fin
    End If
   
    Exit Sub
    
fin:

        MsgBox "Valeur incorrecte", vbCritical
        TxtHeure.Text = "12"
    
End Sub

Sub VerifierMinute()

If Not (IsNumeric(TxtMinute.Text)) Then
        GoTo fin
    End If
    
    If TxtMinute.Text < 0 Then
        GoTo fin
    End If
    
    If TxtMinute.Text > 59 Then
        GoTo fin
    End If
    
   
    Exit Sub
    
fin:

        MsgBox "Valeur incorrecte", vbCritical
        TxtMinute.Text = "00"


End Sub



Sub Zero()

    If Len(TxtMinute.Text) = 1 Then
        TxtMinute.Text = "0" & TxtMinute.Text
    End If
    
End Sub


 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 UN OCX POUR LES PHASES DE LA LUNE
DÉPLACER LA FORM EN CLIQUANT ET GLISSANT AVEC LA SOURIS
Source avec Zip RETOUCHES D'IMAGES
Source avec Zip LECTEUR DE FICHIERS ALEATOIRES (RANDOM)
Source avec Zip LISTEUR DE FICHIERS

 Sources de la même categorie

Source avec Zip Source avec une capture LES FONCTIONS DATE PAR L'EXEMPLE. par pasquet78
Source avec Zip Source avec une capture CALENDRIER, MODE D'EMPLOI par pasquet78
Source avec Zip Source avec une capture Source .NET (Dotnet) HORLOGE DIODE AVEC 3 ALARMES ET REMISE À L'HEURE par EhJoe
Source avec Zip Source avec une capture POINTEUSE HORAIRES PAR SEMAINE par VBNoob13
Source avec Zip Source avec une capture HORLOGE À AIGUILLES SIMPLEMENT DANS UN USERFORM EXCEL par bigbe

Commentaires et avis

Aucun commentaire pour le moment.

 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 : 0,702 sec (4)

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