I finnally found the way to validate dates in a data grid view...
there is a Personnel_Status_Jurnal Table (SQL Server) .in datagrid view
the displayed fields are Status, DateBegin and DateEnd (Also Note).
Status and DateBegin does not allow nulls by default.
I use the following code to validate empty , or not date values.
what i can not do (because i stuck) is that:
1.how (and i think it is easy but i can not see it) to validate if DateEnd<DateBegin
2.Before add a new status ,Date End Must be filled..
please i need some help ....
i try to use the theory ....datagridview(column,row) .value but doesn't work
there is a Personnel_Status_Jurnal Table (SQL Server) .in datagrid view
the displayed fields are Status, DateBegin and DateEnd (Also Note).
Status and DateBegin does not allow nulls by default.
I use the following code to validate empty , or not date values.
VB.NET:
Private Sub Personnel_Status_JournalDataGridView_CellValidating(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellValidatingEventArgs) Handles Personnel_Status_JournalDataGridView.CellValidating
If e.ColumnIndex = 3 Then
If Not IsDate(e.FormattedValue) Or CType(e.FormattedValue, String) = "" Then
Personnel_Status_JournalDataGridView.Rows(e.RowIndex).ErrorText = _
"Must be a Date or Not Empty (Required Date Field)."
e.Cancel = True
End If
End If
If e.ColumnIndex = 4 Then
If Not IsDate(e.FormattedValue) Then
Personnel_Status_JournalDataGridView.Rows(e.RowIndex).ErrorText = _
"Must be a Date ."
e.Cancel = True
End If
End If
End Sub
Private Sub Personnel_Status_JournalDataGridView_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Personnel_Status_JournalDataGridView.CellEndEdit
Personnel_Status_JournalDataGridView.Rows(e.RowIndex).ErrorText = String.Empty
End Sub
1.how (and i think it is easy but i can not see it) to validate if DateEnd<DateBegin
2.Before add a new status ,Date End Must be filled..
please i need some help ....
i try to use the theory ....datagridview(column,row) .value but doesn't work