Bonjour !

J'utilise un DateTimePicker dans un de mes formulaires mais lorsque je change de date, mon application ne réponds plus !

Il faut a chaque fois que je la relaod pour que ca fonctionne.

Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
 
 Private Sub dateTimepicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtDate.ValueChanged
 
            If dateTimepicker1.Checked Then
                Datedebut = dateTimepicker1.Value.Date
            Else
                Datedebut = Nothing
               dateTimepicker1.Value = DateTime.Now.Date
            End If
    End Sub
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
 Private Sub combobox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboCards.SelectedIndexChanged
 
            ' Cédule pour cette journée
            Dim xSchedule As Schedule.CScheduleDayEmp = Schedule.CScheduleDayEmp.GetObject(Me.cPunchEmpNo, Me.Datedebut)
 
            If xSchedule IsNot Nothing AndAlso xSchedule.ntotalhour <> 0 Then
 
                'Vérification si j'ai un puch in et un punch out pour cette journée
                If Punch.debut <> Nothing AndAlso Punch.Fin <> Nothing Then
 
                    DiffTotalHour = xSchedule.totalHeures - Punch.totalHeures 
                    txtTotalWorkCard.Text = DiffTotalHour
 
                    If DiffTotalHour <= 0 Then
                        txtTotalWorkCard.Text = ""
                    End If
                Else
 
                    txtTotalWorkCard.Text = xSchedule.totalHeures 
                End If
 
            End If
 
        End If
 
    End Sub