增加if条件:
Dim sj As Date = date.now
If e.DataCol.name = "结账" Then
If e.NewValue = True Then
If e.DataRow("停止日期") <> Nothing Then
if sj.Hour -10 > 0 then
e.datarow("日期差")= Format(e.datarow("停止日期"), "dd") - Format(e.datarow("开始日期"), "dd") +1
e.DataRow.Locked = True
else
e.datarow("日期差")= Format(e.datarow("停止日期"), "dd") - Format(e.datarow("开始日期"), "dd")
e.DataRow.Locked = True
end if
Else
e.DataRow("停止日期") = (today)
e.datarow("日期差")= Format(e.datarow("停止日期"), "dd") - Format(e.datarow("开始日期"), "dd")
e.DataRow.Locked = True
End If
End If
End If