增加一个条件
如果 验收日期 为空值
计算 剩余时间 交期时长
如果 验收日期 为不空值 不做任何计算
If e.DataCol.Name = "交货日期" Then
If e.DataRow.IsNull("交货日期") Then
e.DataRow("剩余时间") = Nothing
Else
Dim ts As TimeSpan = cdate(e.DataRow("交货日期")) - Date.Today
Dim t1s As TimeSpan = cdate(e.DataRow("交货日期")) - cdate(e.DataRow("下单日期"))
e.DataRow("剩余时间") = ts.TotalDays & "天"
e.DataRow("交期时长") = t1s.TotalDays & "天"
End If
End If