DataColChanged事件
If e.DataCol.Name = "身份证号码" Then
Dim dr As DataRow = e.DataRow
If dr.IsNull("身份证号码") Then
dr("出生年月") = Nothing
dr("年龄") = Nothing
dr("性别") = Nothing
Else
If ValidPIN(dr("身份证号码")) = False Then
msgbox("身份证输入不正确")
Else
dr("出生年月") = ReadBirthday(dr("身份证号码"))
dr("性别") = ReadSex(dr("身份证号码"))
Dim t As TimeSpan = today - CDate(dr("出生年月"))
dr("年龄") = Math.Round(t.TotalDays / 365.2422,2)
End If
End If
End If