Wednesday, June 10, 2009

Date Time patters converting in datagridview

Private Sub UcdgvAuxiliary_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles UcdgvAuxiliary.DataError
Try
If UcdgvAuxiliary.Columns(UcdgvAuxiliary.CurrentCell.ColumnIndex).ValueType.Name = "DateTime" Then
If Not UcdgvAuxiliary.EditingControl Is Nothing Then
If Not UcdgvAuxiliary.EditingControl.Text = "" Then
Dim myDT As New System.Globalization.DateTimeFormatInfo
myDT.ShortDatePattern = "ddMMyyyy"
Dim dt As DateTime = Date.Parse(UcdgvAuxiliary.EditingControl.Text, myDT)
UcdgvAuxiliary.EditingControl.Text = dt
UcdgvAuxiliary.EndEdit()
End If
End If
End If
Catch ex As Exception

No comments:

Post a Comment