在DataColChanged事件
If e.DataCol.Name = "车号" OrElse e.DataCol.Name = "备件名称" OrElse e.DataCol.Name = "安装日期" Then
If e.DataRow.IsNull("车号") = False AndAlso e.DataRow.IsNull("备件名称") = False AndAlso e.DataRow.IsNull("安装日期") = False Then
Dim drf As DataRow = e.DataTable.Find("车号='" & e.DataRow("车号") & "' And 备件名称 = '" & e.DataRow("备件名称") & "' And _Identify <> " & e.DataRow ("_Identify") ,"安装日期 desc")
If drf Is not Nothing Then
drf("使用天数") = (e.DataRow("安装日期") - drf("安装日期")).TotalDays
drf.save
End If
End If
End If
[此贴子已经被作者于2017/5/27 21:19:22编辑过]