26-11-21, 04:26 AM
السلام عليكم
اريد تعديل الكود ليعمل لوب ويتم الحساب على العمود كله مرة واحدة
اريد تعديل الكود ليعمل لوب ويتم الحساب على العمود كله مرة واحدة
كود :
Dim TotalMinit As Integer = 0
Dim TotalHour As Integer = 0
'DataGridView1(4, DataGridView1.CurrentRow.Index).Value = txtTimeIN.Text
TotalMinit = DateDiff(DateInterval.Minute, DataGridView1(3, DataGridView1.CurrentRow.Index).Value, DataGridView1(4, DataGridView1.CurrentRow.Index).Value) ' حساب الفرق بالساعة بين الحضور والانصراف
If TotalMinit > 59 Then
TotalHour += Math.Floor(TotalMinit / 60)
TotalMinit = TotalMinit Mod 60
Dim TotalTime As String = TotalHour.ToString("00") & ":" & TotalMinit.ToString("00")
DataGridView1(5, DataGridView1.CurrentRow.Index).Value = TotalTime
Else
DataGridView1(5, DataGridView1.CurrentRow.Index).Value = "00:" & TotalMinit.ToString("00")
'DataGridView1(5, DataGridView1.CurrentRow.Index).Value = Format("h:mm tt")
End If