Dim i As Integer = 0
Dim datTim1 As Date = CDate(DataGridView1.Rows(i).Cells(8).Value)
Dim datTim2 As Date = CDate(DataGridView1.Rows(i).Cells(9).Value)
lblOverDays.Text = CStr(DateDiff(DateInterval.Day, datTim1, datTim2))
Dim count As Integer = 0
For i As Integer = 0 to DataGridView1.Rows.Count -1
count = count +CStr(DateDiff(DateInterval.Day,CDate(DataGridView1.Rows(i).Cells(8).Value),CDate(DataGridView1.Rows(i).Cells(9).Value)))
Next
lblOverDays.Text = CStr(count)
Dim count As Integer = 0
For i As Integer = 0 To DataGridView1.Rows.Count - 1
If count <= CInt(DateDiff(DateInterval.Day, CDate(DataGridView1.Rows(i).Cells(8).Value), CDate(DataGridView1.Rows(i).Cells(9).Value))) Then
count = count + CInt(DateDiff(DateInterval.Day, CDate(DataGridView1.Rows(i).Cells(8).Value), CDate(DataGridView1.Rows(i).Cells(9).Value)))
End If
Next
lblOverDays.Text = CStr(count)
lblOverTotal.Text = CDbl(count * 4).ToString("#,##0.00") 'นำวันที่เกินไป * ค่าปรับ