一、二進(jìn)制文件讀寫
創(chuàng)新互聯(lián)公司服務(wù)項(xiàng)目包括阿巴嘎網(wǎng)站建設(shè)、阿巴嘎網(wǎng)站制作、阿巴嘎網(wǎng)頁制作以及阿巴嘎網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,阿巴嘎網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到阿巴嘎省份的部分城市,未來相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!
1、寫二進(jìn)制數(shù)據(jù)到指定目錄
==將barray字節(jié)數(shù)組中的數(shù)據(jù)創(chuàng)建在strFilename目錄文件下,存儲(chǔ)格式為二進(jìn)制,F(xiàn)alse表示不添加,直接覆蓋創(chuàng)建。
2、從指定路徑下讀取二進(jìn)制數(shù)據(jù)到數(shù)組
==將目錄中的文件讀取到barry字節(jié)數(shù)組中,即讀取二進(jìn)制文件。
二、字符文件的讀寫
1、 將txtFile控件中的字符寫到srtFileName指定目錄,以創(chuàng)建方式。
2、從srtFileName目錄中的文件讀取到txtFile控件
Visual Basic程序設(shè)計(jì) 教程視頻網(wǎng)絡(luò)視頻: 教學(xué)下載: ;restype=-1id=10000001ty=0pattern=0xmp=0 vb軟件精簡(jiǎn)版: 夠全了吧,一定要采納哦!!!!!!
Dim Wi(1 To 18) As Integer '檢驗(yàn)碼
Private Function SetWi()
Wi(1) = 7
Wi(2) = 9
Wi(3) = 10
Wi(4) = 5
Wi(5) = 8
Wi(6) = 4
Wi(7) = 2
Wi(8) = 1
Wi(9) = 6
Wi(10) = 3
Wi(11) = 7
Wi(12) = 9
Wi(13) = 10
Wi(14) = 5
Wi(15) = 8
Wi(16) = 4
Wi(17) = 2
Wi(18) = 1
End Function
Public Function CheckCIDC15(ByVal StrID15 As String) As String
If Not IsNumeric(StrID15) Then
CheckCIDC15 = "身份證號(hào)碼輸入有誤!有非數(shù)字出現(xiàn)!"
Exit Function
End If
If StrID15 = "111111111111111" Then
CheckCIDC15 = "身份證號(hào)碼輸入錯(cuò)誤"
Exit Function
End If
If Val(Mid(StrID15, 9, 2)) 1 Or Val(Mid(StrID15, 9, 2)) 12 Then
CheckCIDC15 = "身份證號(hào)碼輸入有誤!月份不正確!"
Exit Function
End If
If Val(Mid(StrID15, 11, 2)) 1 Or Val(Mid(StrID15, 11, 2)) 31 Then
CheckCIDC15 = "身份證號(hào)碼輸入有誤!日期不正確!"
Exit Function
Else
If (Val(Mid(StrID15, 9, 2)) = 4 Or Val(Mid(StrID15, 9, 2)) = 6 Or Val(Mid(StrID15, 9, 2)) = 9 Or Val(Mid(StrID15, 9, 2)) = 11) And Val(Mid(StrID15, 11, 2)) = 31 Then
CheckCIDC15 = "身份證號(hào)碼輸入有誤!月份和日期不匹配"
Exit Function
ElseIf Val(Mid(StrID15, 9, 2)) = 2 And (Val(Mid(StrID15, 11, 2)) = 30 Or Val(Mid(StrID15, 11, 2)) = 31) Then
CheckCIDC15 = "身份證號(hào)碼輸入有誤!2月份沒有" Val(Mid(StrID15, 11, 2)) "天"
Exit Function
End If
End If
End Function
Public Function CheckCIDC18(ByVal StrID18 As String) As String
Dim StrID17 As String, AiWi As Integer, num As Integer, A18 As String
SetWi
If Not IsNumeric(Left(StrID18, 17)) Then
CheckCIDC18 = "身份證號(hào)碼輸入有誤!"
Exit Function
End If
If Val(Mid(StrID18, 11, 2)) 1 Or Val(Mid(StrID18, 11, 2)) 12 Then
CheckCIDC18 = "身份證號(hào)碼輸入有誤!月份不正確!"
Exit Function
End If
If Val(Mid(StrID18, 13, 2)) 1 Or Val(Mid(StrID18, 13, 2)) 31 Then
CheckCIDC18 = "身份證號(hào)碼輸入有誤!" vbCrLf "日期不正確!"
Exit Function
Else
If (Val(Mid(StrID18, 11, 2)) = 4 Or Val(Mid(StrID18, 11, 2)) = 6 Or Val(Mid(StrID18, 11, 2)) = 9 Or Val(Mid(StrID18, 11, 2)) = 11) And Val(Mid(StrID18, 13, 2)) = 31 Then
CheckCIDC18 = "身份證號(hào)碼輸入有誤!月份和日期不匹配"
Exit Function
ElseIf Val(Mid(StrID18, 11, 2)) = 2 And (Val(Mid(StrID18, 13, 2)) = 30 Or Val(Mid(StrID18, 13, 2)) = 31) Then
CheckCIDC18 = "身份證號(hào)碼輸入有誤!2月份沒有" Val(Mid(StrID18, 13, 2)) "天"
Exit Function
End If
End If
StrID17 = Left(StrID18, 17)
AiWi = 0
For num = 1 To 17
AiWi = AiWi + Val(Mid(StrID17, num, 1)) * Wi(num)
Next num
Select Case AiWi Mod 11
Case 0
A18 = "1"
Case 1
A18 = "0"
Case 2
A18 = "X"
Case 3
A18 = "9"
Case 4
A18 = "8"
Case 5
A18 = "7"
Case 6
A18 = "6"
Case 7
A18 = "5"
Case 8
A18 = "4"
Case 9
A18 = "3"
Case 10
A18 = "2"
End Select
If A18 Right(StrID18, 1) Then
CheckCIDC18 = "身份證號(hào)碼輸入有誤!" '尾數(shù)檢驗(yàn)馬不正確"
Exit Function
End If
End Function
Public Function CIDC15To18(ByVal StrID15 As String) As String
SetWi
Dim StrID17 As String, StrID18 As String, num As Integer, AiWi As Integer
If Not IsNumeric(StrID15) Then
CIDC15To18 = "15位身份證號(hào)碼輸入有誤!" vbCrLf "有非數(shù)字出現(xiàn)!"
Exit Function
End If
If Val(Mid(StrID15, 9, 2)) 1 Or Val(Mid(StrID15, 9, 2)) 12 Then
CIDC15To18 = "身份證號(hào)碼輸入有誤!" vbCrLf "月份不正確!"
Exit Function
End If
If Val(Mid(StrID15, 11, 2)) 1 Or Val(Mid(StrID15, 11, 2)) 31 Then
CIDC15To18 = "身份證號(hào)碼輸入有誤!" vbCrLf "日期不正確!"
Exit Function
Else
If (Val(Mid(StrID15, 9, 2)) = 4 Or Val(Mid(StrID15, 9, 2)) = 6 Or Val(Mid(StrID15, 9, 2)) = 9 Or Val(Mid(StrID15, 9, 2)) = 11) And Val(Mid(StrID15, 11, 2)) = 31 Then
CIDC15To18 = "身份證號(hào)碼輸入有誤!" vbCrLf "月份和日期不匹配"
Exit Function
ElseIf Val(Mid(StrID15, 9, 2)) = 2 And (Val(Mid(StrID15, 11, 2)) = 30 Or Val(Mid(StrID15, 11, 2)) = 31) Then
CIDC15To18 = "身份證號(hào)碼輸入有誤!" vbCrLf "2月份沒有" Val(Mid(StrID15, 11, 2)) "天"
Exit Function
End If
End If
StrID17 = Left(StrID15, 6) "19" Right(StrID15, 9)
AiWi = 0
For num = 1 To 17
AiWi = AiWi + Val(Mid(StrID17, num, 1)) * Wi(num)
Next num
Select Case AiWi Mod 11
Case 0
StrID18 = StrID17 "1"
Case 1
StrID18 = StrID17 "0"
Case 2
StrID18 = StrID17 "X"
Case 3
StrID18 = StrID17 "9"
Case 4
StrID18 = StrID17 "8"
Case 5
StrID18 = StrID17 "7"
Case 6
StrID18 = StrID17 "6"
Case 7
StrID18 = StrID17 "5"
Case 8
StrID18 = StrID17 "4"
Case 9
StrID18 = StrID17 "3"
Case 10
StrID18 = StrID17 "2"
End Select
CIDC15To18 = StrID18
End Function
'身份證檢驗(yàn)函數(shù),如果有錯(cuò)誤,則彈出正確信息,若正確,則繼續(xù)執(zhí)行
Function CIDCheck(strId As String) As String
If Len(strId) = 15 Then
CIDCheck = CheckCIDC15(strId)
ElseIf Len(strId) = 18 Then
CIDCheck = CheckCIDC18(strId)
Else
CIDCheck = "身份證位數(shù)不對(duì)"
End If
End Function
1、實(shí)現(xiàn)上傳按鈕方法代碼。
2、判斷圖片對(duì)象是否為空代碼。
3、取得數(shù)據(jù)庫字段 dt.Rows(0)("Pic")方法代碼。
4、字節(jié)數(shù)組轉(zhuǎn)換為Image類型方法代碼。
5、處理SQL中操作Image類型方法代碼。
6、實(shí)現(xiàn)的上傳結(jié)果。
網(wǎng)頁標(biāo)題:vb.net身份證讀取 vb編寫身份證程序
URL標(biāo)題:http://vcdvsql.cn/article42/ddcsoec.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供做網(wǎng)站、標(biāo)簽優(yōu)化、網(wǎng)頁設(shè)計(jì)公司、網(wǎng)站改版、App開發(fā)、定制開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)