If e.DataCol.Name = "保质期" Then If e.DataRow.IsNull("保质期") Then e.DataRow("剩余天数") = Nothing Else Dim t As TimeSpan t = CDate(e.DataRow("保质期")) - Date.Today If t.TotalDays < 0 Then e.DataRow("剩余天数") = 0 Else e.DataRow("剩余天数") = t.TotalDays End If End If End If