VB.Net读取身份证效果图
读取社保卡效果图
下面是EST-100系列身份证读卡器VB.Net的全部代码:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Donsee_Open("USB")
Donsee_Beep()
If (Donsee_Open("USB") = 0) Then
Dim pszVersion As String
pszVersion = Space(50)
Donsee_Version(pszVersion)
RichTextBox1.Text += "广东东信读卡器打开成功,返回值:" + Donsee_Open("USB").ToString + vbCrLf
RichTextBox1.Text += "EST-100设备版本号:" + pszVersion.ToString + vbCrLf
Else
RichTextBox1.Text += "广东东信读卡器打开失败,请检查读卡器是否接好" + vbCrLf
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
RichTextBox1.Text = ""
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Donsee_Open("USB")
If (Donsee_Open("USB") = 0) Then
Dim pszUID As String
pszUID = Space(30)
Donsee_ReadIDCardUid(pszUID)
If (Donsee_ReadIDCardUid(pszUID) = 0) Then
Donsee_Beep()
RichTextBox1.Text += "身份证ID读取成功:" + pszUID.ToString + vbCrLf
Else
RichTextBox1.Text += "身份证ID读取失败" + vbCrLf
End If
Else
RichTextBox1.Text += "读卡器打开失败,请检查读卡器是否接好" + vbCrLf
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Donsee_Open("USB")
If (Donsee_Open("USB") = 0) Then
Dim t_nRe As Integer
Dim idinfo As IDINFO
Dim t_arrChMsg As String
t_arrChMsg = Space(256)
t_nRe = Donsee_ReadIDCard(1, "IDphoto.jpg", idinfo, t_arrChMsg)
If (t_nRe = 0) Then
Donsee_Beep()
RichTextBox1.Text += "身份证读取成功:" + idinfo.name + vbCrLf
If (idinfo.certType.ToString = "I") Then '外国人居住证
RichTextBox1.Text += "读取成功,证件类型:外国人居住证" + vbCrLf
RichTextBox1.Text += "证件类型标识:" + idinfo.certType.ToString + vbCrLf
RichTextBox1.Text += "英文姓名:" + idinfo.ENfullname + vbCrLf
RichTextBox1.Text += "性 别:" + idinfo.sex + vbCrLf
RichTextBox1.Text += "永久居留证号码:" + idinfo.number + vbCrLf
RichTextBox1.Text += "国籍或所在地区代码:" + idinfo.Nationality + vbCrLf
RichTextBox1.Text += "中文姓名:" + idinfo.name + vbCrLf
RichTextBox1.Text += "证件签发日期:" + idinfo.signdate + vbCrLf
RichTextBox1.Text += "证件终止日期:" + idinfo.validterm + vbCrLf
RichTextBox1.Text += "出生日期:" + idinfo.birthday + vbCrLf
RichTextBox1.Text += "证件版本号:" + idinfo.certVersion + vbCrLf
RichTextBox1.Text += "申请机关代码:" + idinfo.organs + vbCrLf
ElseIf (idinfo.certType.ToString = "J") Then '港澳台通行证
RichTextBox1.Text += "读取成功,证件类型:港澳台通行证" + vbCrLf
RichTextBox1.Text += "证件类型标识:" + idinfo.certType.ToString + vbCrLf
RichTextBox1.Text += "姓名:" + idinfo.name + vbCrLf
RichTextBox1.Text += "性别:" + idinfo.sex + vbCrLf
RichTextBox1.Text += "出生日期:" + idinfo.birthday + vbCrLf
RichTextBox1.Text += "住址:" + idinfo.address + vbCrLf
RichTextBox1.Text += "公民身份号码:" + idinfo.number + vbCrLf
RichTextBox1.Text += "签发机关:" + idinfo.organs + vbCrLf
RichTextBox1.Text += "有效期起始日期:" + idinfo.signdate + vbCrLf
RichTextBox1.Text += "有效期截止日期:" + idinfo.validterm + vbCrLf
RichTextBox1.Text += "通行证号码:" + idinfo.passNu + vbCrLf
RichTextBox1.Text += "签发次数:" + idinfo.signCount + vbCrLf
Else
RichTextBox1.Text += "读取成功,证件类型:居民身份证" + vbCrLf
RichTextBox1.Text += "证件标识:" + idinfo.certType.ToString + vbCrLf
RichTextBox1.Text += "姓 名:" + idinfo.name + vbCrLf
RichTextBox1.Text += "性 别:" + idinfo.sex + vbCrLf
RichTextBox1.Text += "名 族:" + idinfo.people + vbCrLf
RichTextBox1.Text += "出生日期:" + idinfo.birthday + vbCrLf
RichTextBox1.Text += "住 址:" + idinfo.address + vbCrLf
RichTextBox1.Text += "发证日期:" + idinfo.signdate + vbCrLf
RichTextBox1.Text += "有效日期:" + idinfo.validterm + vbCrLf
RichTextBox1.Text += "证件号码:" + idinfo.number + vbCrLf
RichTextBox1.Text += "发证机关:" + idinfo.organs + vbCrLf
RichTextBox1.Text += "其 他:" + idinfo.Other + vbCrLf
End If
Else
RichTextBox1.Text += "身份证读取失败:" + t_arrChMsg + vbCrLf
RichTextBox1.Text += ",返回值:" + t_nRe.ToString + vbCrLf
End If
Else
RichTextBox1.Text += "读卡器打开失败,请检查读卡器是否接好" + vbCrLf
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Donsee_Open("USB")
If (Donsee_Open("USB") = 0) Then
Dim t_nRe As Integer
Dim cardInfo As SSCard_IDINFO
Dim arrChMsg As String
arrChMsg = Space(256)
t_nRe = Donsee_ReadSSCard(17, cardInfo, arrChMsg) '0x11 16进制填17进去表示SAM1
If (t_nRe = 0) Then
Donsee_Beep()
RichTextBox1.Text += "社保卡读取成功,返回值:" + t_nRe.ToString + vbCrLf
RichTextBox1.Text += "姓名:" + cardInfo.name + vbCrLf
RichTextBox1.Text += "性别:" + cardInfo.sex + vbCrLf
RichTextBox1.Text += "民族:" + cardInfo.nation + vbCrLf
RichTextBox1.Text += "出生日期:" + cardInfo.birthday + vbCrLf
RichTextBox1.Text += "发证日期:" + cardInfo.signdat + vbCrLf
RichTextBox1.Text += "有效日期:" + cardInfo.validterm + vbCrLf
RichTextBox1.Text += "卡号:" + cardInfo.cardnumber + vbCrLf
RichTextBox1.Text += "身份证号:" + cardInfo.idnumber + vbCrLf
RichTextBox1.Text += "城市代码:" + cardInfo.city + vbCrLf
RichTextBox1.Text += "社保卡版本:" + cardInfo.cardveVrsion + vbCrLf
RichTextBox1.Text += "卡识别码:" + cardInfo.identityCode + vbCrLf
'RichTextBox1.Text += "PSAM卡卡号:" + cardInfo.szTerminalNo + vbCrLf
RichTextBox1.Text += "其他:" + cardInfo.Other + vbCrLf
Else
RichTextBox1.Text += "社保卡读取失败:" + arrChMsg + vbCrLf
RichTextBox1.Text += ",返回值:" + t_nRe.ToString + vbCrLf
End If
Else
RichTextBox1.Text += "读卡器打开失败,请检查读卡器是否接好" + vbCrLf
End If
End Sub
End Class