📄 id.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "中国人民共和国公民身份证号码升位查询系统"
ClientHeight = 2400
ClientLeft = 45
ClientTop = 330
ClientWidth = 4215
Icon = "ID.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2400
ScaleWidth = 4215
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox Picture3
Height = 420
Left = 3435
ScaleHeight = 360
ScaleWidth = 480
TabIndex = 8
Top = 1680
Width = 540
End
Begin VB.TextBox Text2
Alignment = 2 'Center
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 240
Locked = -1 'True
TabIndex = 6
Top = 1680
Width = 2940
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 240
TabIndex = 4
Text = "510902801021586"
ToolTipText = "请在这里输入你的身份证号码"
Top = 600
Width = 2400
End
Begin VB.CommandButton Command1
Caption = "号码升位"
Height = 420
Left = 2880
TabIndex = 3
Top = 600
Width = 1095
End
Begin VB.PictureBox Picture2
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 540
Left = 1800
Picture = "ID.frx":1EE2
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 1
Top = 1080
Visible = 0 'False
Width = 540
End
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 540
Left = 2400
Picture = "ID.frx":21EC
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 0
Top = 1080
Visible = 0 'False
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "性别:"
Height = 180
Left = 3450
TabIndex = 7
Top = 1320
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "新身份证号码:"
Height = 180
Left = 240
TabIndex = 5
Top = 1320
Width = 1260
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "原身份证号码:"
Height = 180
Left = 240
TabIndex = 2
Top = 240
Width = 1260
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'计算新的身份证号码
Private Sub Command1_Click()
Dim id As String
Dim num As Integer
'提取原号码
id = Text1.Text
If Len(id) <> 15 Then
MsgBox "ID号码长度不正确,请检查!", vbCritical
Exit Sub
End If
'年份升位
id = Left(id, 6) + "19" + Right(id, 9)
'计算校验码和
For i = 18 To 2 Step -1
t = Asc(Mid(id, 19 - i, 1))
If t < 47 Or t > 58 Then
MsgBox "发现非ID号码字符,请检查!", vbCritical
Exit Sub
End If
num = num + Val((Mid(id, 19 - i, 1))) * (2 ^ (i - 1) Mod 11)
Next i
'计算校验码值
num = num Mod 11
'确定校验码
Select Case num
Case 0
id = id + "1"
Case 1
id = id + "0"
Case 2
id = id + "X"
Case Else
id = id + CStr(12 - num)
End Select
'显示新号码
Text2.Text = id
'显示性别,男性倒数第二位为奇数,女性为偶数
If Val(Mid(id, 17, 1)) Mod 2 = 1 Then
Picture3.Picture = Picture1.Picture
Else
Picture3.Picture = Picture2.Picture
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -