?? 身份證驗證_馬濤制作1.frm
字號:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "身份證驗證 天馬制作@版權(quán)所有"
ClientHeight = 5070
ClientLeft = 45
ClientTop = 330
ClientWidth = 6915
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "身份證驗證_馬濤制作1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5070
ScaleWidth = 6915
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdrein
Caption = "重新輸入(&R)"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 3600
TabIndex = 7
Top = 1200
Width = 1575
End
Begin VB.Frame Frame1
Caption = "身份證信息:"
BeginProperty Font
Name = "宋體"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000040&
Height = 2655
Left = 240
TabIndex = 3
Top = 2160
Width = 6375
Begin VB.OptionButton optwom
Caption = "女"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4440
TabIndex = 11
Top = 1440
Width = 1575
End
Begin VB.OptionButton optman
Caption = "男"
BeginProperty Font
Name = "宋體"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4440
TabIndex = 10
Top = 720
Width = 1695
End
Begin VB.Label lblbir
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 480
Left = 840
TabIndex = 9
Top = 1560
Width = 2280
End
Begin VB.Label lblpro
AutoSize = -1 'True
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 840
TabIndex = 8
Top = 600
Width = 2535
WordWrap = -1 'True
End
Begin VB.Label Label5
Caption = "性別:"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3720
TabIndex = 6
Top = 1080
Width = 855
End
Begin VB.Label Label4
Caption = "生日:"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 5
Top = 1560
Width = 855
End
Begin VB.Label Label2
Caption = "籍貫:"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 4
Top = 600
Width = 855
End
End
Begin VB.CommandButton cmdchck
Caption = "查詢"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1440
TabIndex = 2
Top = 1200
Width = 1575
End
Begin VB.TextBox txtnum
BeginProperty Font
Name = "宋體"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2280
MaxLength = 18
TabIndex = 1
Top = 480
Width = 3975
End
Begin VB.Label label1
Caption = "請輸入15位或18位身份證號碼:"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 240
TabIndex = 0
Top = 240
Width = 1935
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Sub check(ByVal num As String) '檢查身份證號碼
Dim chyear As String
Dim chmonth As String
Dim chday As String
Dim font_six As String
Dim province_result As String
font_six = Left(num, 6)
Dim le As Integer
le = Len(num)
If le = 15 Or le = 18 Then '檢查號碼長度是否正確
If le = 15 Then
chyear = "19" & Mid(num, 7, 2)
chmonth = Mid(num, 9, 2)
chday = Mid(num, 11, 2)
If IsDate(chday & " " & chmonth & "," & chyear) Then
If CDate(Str(Val(chyear) + 16) & "/" & chmonth & "/" & chday) > Date Then
MsgBox "你未滿16周歲嗎?請重新檢查身份證!", vbOKOnly + vbExclamation, "身份證號碼有誤"
cmdrein_Click
Exit Sub
Else
province_result = Form2.query_province(font_six)
If Val(province_result) > 0 Then
MsgBox "身份證號碼前6位有誤,請重新輸入!", vbOKOnly + vbExclamation, "身份證號碼有誤"
cmdrein_Click
Exit Sub
Else
lblpro = province_result
lblbir = chyear & " 年" & Str(Val(chmonth)) & "月" & Str(Val(chday)) & "日"
optman.Enabled = True
optwom.Enabled = True
If Val(Right(num, 1)) Mod 2 = 1 Then
optman.Value = True
Else
optwom.Value = True
End If
End If
End If
Else
MsgBox "身份證號碼生日輸入有誤,請重新輸入!", vbOKOnly + vbExclamation, "身份證號碼有誤"
cmdrein_Click
Exit Sub
End If
Else
chyear = Mid(num, 7, 4)
chmonth = Mid(num, 11, 2)
chday = Mid(num, 13, 2)
If IsDate(chday & " " & chmonth & "," & chyear) Then
If CDate(Str(Val(chyear) + 16) & "/" & chmonth & "/" & chday) > Date Then
MsgBox "你未滿16周歲嗎?請重新檢查身份證!", vbOKOnly + vbExclamation, "身份證號碼有誤"
cmdrein_Click
Exit Sub
ElseIf CInt(chyear) < 1900 Then
MsgBox "你未免也太老了吧,請重新檢查身份證!", vbOKOnly + vbExclamation, "身份證號碼有誤"
cmdrein_Click
Exit Sub
Else
province_result = Form2.query_province(font_six)
If Val(province_result) > 0 Then
MsgBox "身份證號碼前6位有誤,請重新輸入!", vbOKOnly + vbExclamation, "身份證號碼有誤"
cmdrein_Click
Exit Sub
Else
lblpro = province_result
lblbir = chyear & " 年" & Str(Val(chmonth)) & "月" & Str(Val(chday)) & "日"
optman.Enabled = True
optwom.Enabled = True
If Val(Left(Right(num, 2), 1)) Mod 2 = 1 Then
optman.Value = True
Else
optwom.Value = True
End If
End If
End If
Else
MsgBox "身份證號碼生日輸入有誤,請重新輸入!", vbOKOnly + vbExclamation, "身份證號碼有誤"
cmdrein_Click
Exit Sub
End If
End If
Else
MsgBox "身份證號碼位數(shù)不對,請重新輸入!", vbOKOnly + vbExclamation, "身份證號碼有誤"
cmdrein_Click
Exit Sub
End If
End Sub
Private Sub cmdchck_Click() '點擊"查詢"按鈕時
Call check(txtnum.Text)
cmdchck.Enabled = False
End Sub
Private Sub cmdrein_Click() '點擊"重新輸入"按鈕時
txtnum.Enabled = True
txtnum.SelStart = 0
txtnum.SelLength = Len(txtnum.Text)
txtnum.SetFocus
End Sub
Private Sub Form_Load()
cmdchck.Enabled = False
cmdrein.Enabled = False
optman.Value = False
optwom.Value = False
optman.Enabled = False
optwom.Enabled = False
Form2.Form_Load
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'點擊"關(guān)閉時"
If UnloadMode = 0 Then End
End Sub
Private Sub txtnum_Change() '文本框的值有所改變時
cmdchck.Enabled = True
cmdrein.Enabled = True
End Sub
Private Sub txtnum_KeyPress(KeyAscii As Integer) '利用鍵盤輸入時
If KeyAscii > 47 And KeyAscii < 58 Or KeyAscii = 8 Then Exit Sub
If KeyAscii = 13 Then
cmdchck_Click
Exit Sub
End If
KeyAscii = 0
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -