DataColChanged事件:
If e.DataCol.Name = "出生日期" Then
If e.DataRow.IsNull("出生日期") Then
e.DataRow("年龄") = Nothing
Else
Dim d1 As Integer = Date.Today().year
Dim d2 As Integer = Date.Today().month
Dim d3 As Integer = Date.Today().day
Dim c1 As Integer = e.DataRow("出生日期").year
Dim c2 As Integer = e.DataRow("出生日期").month
Dim c3 As Integer = e.DataRow("出生日期").day
Dim t1,t2,t3 As Integer
If d3>=c3 Then
t3=d3-c3
Else
t3=d3-c3+30
d2=d2-1
End If
If d2>=c2 Then
t2=d2-c2
Else
t2=d2-c2+12
d1=d1-1
End If
t1=d1-c1
e.DataRow("年龄")=t1 & "岁" & t2 & "月" & t3 & "天"
End If
End If