表达式列计算不了,需要使用代码处理,参考:
http://www.foxtable.com/webhelp/topics/2647.htm
可以如下设置DataColChanged事件:
Select Case e.DataCol.name
Case "身份证号"
If e.DataRow.IsNull("身份证号") Then
e.DataRow("年龄") = Nothing
Else
Dim tp As TimeSpan = Date.today - CDate(ReadBirthDay(e.DataRow("身份证号")))
e.DataRow("年龄") = Math.Round(tp.TotalDays / 365.2422,2)
End If
End Select