03-03-13, 01:45 AM
السلام عليكم ورحمة الله وبركاته
يتم ذلك في حدث CellFormatting التابع لأداة الـ Datagridview :
قد توجد طرق أخرى مختصرة الأكواد فقط ابحث بالإنترنت .
****
***
**
*
يتم ذلك في حدث CellFormatting التابع لأداة الـ Datagridview :
كود :
Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting Try
If e.ColumnIndex = 1 Then ' نتحقق من أن العمود الذي يتم تحريره هو العمود المطلوب
If e.Value IsNot Nothing Then
If e.Value.ToString.Contains(":") = False Then
Dim val As String = e.Value
val = val & ":0"
e.Value = val
End If
Dim d As DateTime = DateTime.Parse(e.Value.ToString)
Dim time As String = d.ToString("hh:mm:ss")
e.Value = time
e.FormattingApplied = True
End If
End If
Catch ex As Exception
e.FormattingApplied = False
End Try
End Subقد توجد طرق أخرى مختصرة الأكواد فقط ابحث بالإنترنت .
****
***
**
*

