📄 frminplan.frm
字号:
VERSION 5.00
Begin VB.Form frmInPlan
BorderStyle = 1 'Fixed Single
Caption = "输入招生计划"
ClientHeight = 2700
ClientLeft = 45
ClientTop = 330
ClientWidth = 5805
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2700
ScaleWidth = 5805
Begin VB.CommandButton cmdReset
Caption = "取消重填"
Height = 375
Left = 3360
TabIndex = 8
Top = 2040
Width = 1335
End
Begin VB.CommandButton cmdAddPlan
Caption = "加入招生计划"
Height = 375
Left = 1080
TabIndex = 7
Top = 2040
Width = 1335
End
Begin VB.Frame Frame1
Height = 1455
Left = 120
TabIndex = 0
Top = 240
Width = 5415
Begin VB.TextBox txtNum
Height = 375
Left = 3840
TabIndex = 6
Top = 840
Width = 1095
End
Begin VB.TextBox txtProv
Height = 375
Left = 1080
TabIndex = 4
Top = 840
Width = 1335
End
Begin VB.TextBox txtDept
Height = 375
Left = 1080
TabIndex = 2
Top = 240
Width = 2655
End
Begin VB.Label Label3
Caption = "招生人数:"
Height = 255
Left = 2640
TabIndex = 5
Top = 960
Width = 975
End
Begin VB.Label Label2
Caption = "省份:"
Height = 255
Left = 240
TabIndex = 3
Top = 960
Width = 855
End
Begin VB.Label Label1
Caption = "院系:"
Height = 255
Left = 240
TabIndex = 1
Top = 240
Width = 615
End
End
End
Attribute VB_Name = "frmInPlan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdAddPlan_Click()
'先检测输入框是否为空,如为空,则提示用户
If txtDept.Text = "" Or txtProv.Text = "" Or txtNum.Text = "" Then
MsgBox "请正确输入信息后再加入招生计划表!", vbOKOnly + vbInformation, "注意"
Exit Sub
End If
'如果输入信息正确,则打开数据表添加数据
Dim rs_plan As New ADODB.Recordset
Dim sqlplan As String
sqlplan = "select * from 招生计划表"
rs_plan.CursorLocation = adUseClient
rs_plan.Open sqlplan, conn, adOpenStatic, adLockPessimistic
rs_plan.AddNew
rs_plan.Fields(0) = txtDept.Text
rs_plan.Fields(1) = txtProv.Text
rs_plan.Fields(2) = txtNum.Text
'要求用户确认是否确实要加入招生计划表
Dim an As String
an = MsgBox("确定要加入招生计划表吗?", vbYesNo, "")
If an = vbYes Then
rs_plan.Update
rs_plan.Close
MsgBox "加入信息成功!", vbOKOnly + vbInformation, "注意"
Else
rs_plan.CancelUpdate
rs_plan.Close
Exit Sub
End If
End Sub
Private Sub cmdReset_Click()
'置空所有TextBox
txtDept.Text = ""
txtProv.Text = ""
txtNum.Text = ""
End Sub
Private Sub Form_Load()
Dim X0 As Long
Dim Y0 As Long
'让窗体居中
X0 = Screen.Width
Y0 = Screen.Height
X0 = (X0 - Me.Width) / 2
Y0 = (Y0 - Me.Height) / 2
Me.Move X0, Y0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -