DataColChanged事件,试试这个
If e.DataCol.name = "出生年月" Then
If e.DataRow.IsNull("出生年月") = False
If Date.Today.Month >= CInt(e.DataRow("出生年月").split(".")(1))
e.DataRow("年龄") = Date.Today.Year - CInt(e.DataRow("出生年月").split(".")(0))
Else
e.DataRow("年龄") = Date.Today.Year - CInt(e.DataRow("出生年月").split(".")(0)) -1
End If
Else
e.DataRow("年龄") = Nothing
End If
End If