我只想问是否可以比较 xtragrid gridView1.Columns("DateInstalled") 和 Date.today?
这是我的代码,它对我不起作用:
Private Sub GridView1_RowCellStyle(sender As Object, e As Views.Grid.RowCellStyleEventArgs) Handles GridView1.RowCellStyle
Dim dateExp As Date = Date.Parse(GridView1.Columns("DateExpired"))
If dateExp < Date.Today Then
e.Appearance.BackColor = Color.Red
End If
End Sub
输出是,如果 Date.Today 大于 column("DateExpired"),它会用高亮填充整行,表示它已过期。
真诚的,
试试这个:
Private Sub GridView1_RowCellStyle(sender As Object, e As DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs) Handles GridView1.RowCellStyle
Dim dateExp As Date = Date.Parse(GridView1.GetRowCellValue(e.RowHandle, "DateExpired"))
If dateExp < Date.Today Then
e.Appearance.BackColor = Color.Red
End If
End Sub