Validation and stuff

This commit is contained in:
Jonathan Jenne
2021-11-16 16:16:46 +01:00
parent 964f2ee60c
commit 47c22e9361
13 changed files with 140 additions and 70 deletions

View File

@@ -247,23 +247,25 @@ Public Class frmRowEditor
Private Sub GridView1_CustomDrawCell(sender As Object, e As DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs) Handles GridView1.CustomDrawCell
Dim oDataRow As DataRow = GridView1.GetDataRow(e.RowHandle)
Dim oKey As String = oDataRow.Item(COL_KEY)
If e.Column.FieldName = COL_VALUE_FINAL Then
Dim oColumn = _Table.Columns.
Dim oValue As String = oDataRow.Item(COL_VALUE_FINAL)
Dim oColumn = _Table.Columns.
Where(Function(c) c.Name = oKey).
SingleOrDefault()
If e.Column.FieldName = COL_VALUE_FINAL Then
If oColumn Is Nothing Then
Exit Sub
End If
If oColumn.Config?.IsReadOnly Then
e.Appearance.BackColor = Color.LightGray
End If
If oColumn.Config?.IsReadOnly Then
e.Appearance.BackColor = Color.LightGray
If oColumn.Config?.IsRequired AndAlso e.CellValue.ToString.Length = 0 Then
e.Appearance.BackColor = Color.LightCoral
End If
End If
End If
If (oColumn.IsRequired Or oColumn.Config?.IsRequired) AndAlso e.CellValue.ToString.Length = 0 Then
e.Appearance.BackColor = Color.LightCoral
End If
If oColumn.Config?.IsRequired AndAlso oValue.ToString.Length = 0 Then
e.Appearance.BackColor = Color.LightCoral
End If
End Sub
End Class