【员工资料】表属性 Datacolchanged
If e.DataCol.Name = "身份证" Then
If e.DataRow.IsNull("身份证") Then
' e.DataRow("出生日期") = Nothing
' e.DataRow("性别") = Nothing
Else
If ValidPIN(e.DataRow("身份证")) Then
e.DataRow("出生日期") = ReadBirthday(e.DataRow("身份证" ))
e.DataRow("性别") = ReadSex(e.DataRow("身份证" ))
Else
e.Cancel = True '取
MessageBox.show("身份证号码错!","系统提示",MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End If
End If
Select Case e.DataCol.name
Case "出生日期"
If e.DataRow.IsNull("出生日期") Then
e.DataRow("年龄") = Nothing
Else
Dim tp As TimeSpan = Date.today - CDate(e.DataRow("出生日期"))
e.DataRow("年龄") = Math.Round(tp.TotalDays / 365.2422,2)
End If
End Select