用DATEDIFF函数求差值,绑定到DBGRID一列,在它的itemdatabound事件里判断if e.item.cells(x).text>... then
     e.Item.Cells(x).fontColor = Color.AliceBlue
end if

解决方案 »

  1.   

    try it,我只是提供个思路
    Private Sub DataGrid2_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid2.ItemDataBound
            If e.Item.ItemIndex >= 0 Then
                If CInt(e.Item.Cells(0).Text) > 300 Then
                    e.Item.BackColor = System.Drawing.Color.Brown
                Else
                    e.Item.BackColor = System.Drawing.Color.Gray
                End If
            End If
        End Sub
      

  2.   

    Color.AliceBlue?系统说没有color这个对象
      

  3.   

    还有啊,4行数据,我查了一下它们的itemindex,却是-1,0,1,2,3,-1
    为什么会多出来2个-1呢?这两个-1又代表什么呢?