⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form4.frm

📁 是自己编写的学生学籍管理系统.其中添加了查询、插入、删除等功能。
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form4 
   BackColor       =   &H00FF80FF&
   Caption         =   "工商0102数据库资料添加页"
   ClientHeight    =   5565
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6300
   LinkTopic       =   "Form4"
   ScaleHeight     =   5565
   ScaleWidth      =   6300
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command5 
      Caption         =   "查找"
      Height          =   495
      Left            =   4080
      TabIndex        =   22
      Top             =   4800
      Width           =   735
   End
   Begin VB.CommandButton Command4 
      Caption         =   "修改"
      Height          =   495
      Left            =   2760
      TabIndex        =   21
      Top             =   4800
      Width           =   735
   End
   Begin VB.CommandButton Command3 
      Caption         =   "删除"
      Height          =   495
      Left            =   1560
      TabIndex        =   20
      Top             =   4800
      Width           =   735
   End
   Begin VB.Data Data1 
      Connect         =   "Access"
      DatabaseName    =   "A:\Wsm.mdb"
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   285
      Left            =   360
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "Stulnfo"
      Top             =   360
      Width           =   5580
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   495
      Left            =   5160
      TabIndex        =   19
      Top             =   4800
      Width           =   735
   End
   Begin VB.CommandButton Command1 
      Caption         =   "添加"
      Height          =   495
      Left            =   360
      TabIndex        =   18
      Top             =   4800
      Width           =   735
   End
   Begin VB.TextBox Text9 
      DataField       =   "个人爱好"
      DataSource      =   "Data1"
      Height          =   495
      Left            =   1800
      TabIndex        =   17
      Top             =   4200
      Width           =   4095
   End
   Begin VB.TextBox Text8 
      DataField       =   "其他描述"
      DataSource      =   "Data1"
      Height          =   495
      Left            =   1800
      TabIndex        =   15
      Top             =   3480
      Width           =   4095
   End
   Begin VB.TextBox Text7 
      DataField       =   "专业"
      DataSource      =   "Data1"
      Height          =   495
      Left            =   3720
      TabIndex        =   13
      Top             =   2640
      Width           =   2175
   End
   Begin VB.TextBox Text6 
      DataField       =   "系别"
      DataSource      =   "Data1"
      Height          =   495
      Left            =   1200
      TabIndex        =   11
      Top             =   2640
      Width           =   1575
   End
   Begin VB.TextBox Text5 
      DataField       =   "籍贯"
      DataSource      =   "Data1"
      Height          =   495
      Left            =   3120
      TabIndex        =   9
      Top             =   1800
      Width           =   2775
   End
   Begin VB.TextBox Text4 
      DataField       =   "性别"
      DataSource      =   "Data1"
      Height          =   495
      Left            =   1200
      TabIndex        =   7
      Top             =   1800
      Width           =   855
   End
   Begin VB.TextBox Text3 
      DataField       =   "年龄"
      DataSource      =   "Data1"
      Height          =   495
      Left            =   5160
      TabIndex        =   5
      Top             =   1080
      Width           =   735
   End
   Begin VB.TextBox Text2 
      DataField       =   "姓名"
      DataSource      =   "Data1"
      Height          =   495
      Left            =   3120
      TabIndex        =   3
      Top             =   1080
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      DataField       =   "学号"
      DataSource      =   "Data1"
      Height          =   495
      Left            =   1200
      TabIndex        =   0
      Top             =   1080
      Width           =   855
   End
   Begin VB.Label Label9 
      BackColor       =   &H00FF80FF&
      Caption         =   "个人爱好 "
      Height          =   495
      Left            =   480
      TabIndex        =   16
      Top             =   4200
      Width           =   1095
   End
   Begin VB.Label Label8 
      BackColor       =   &H00FF80FF&
      Caption         =   "其他描述 "
      Height          =   375
      Left            =   480
      TabIndex        =   14
      Top             =   3480
      Width           =   1095
   End
   Begin VB.Label Label7 
      BackColor       =   &H00FF80FF&
      Caption         =   "专业"
      Height          =   495
      Left            =   3000
      TabIndex        =   12
      Top             =   2640
      Width           =   615
   End
   Begin VB.Label Label6 
      BackColor       =   &H00FF80FF&
      Caption         =   "系别"
      Height          =   495
      Left            =   480
      TabIndex        =   10
      Top             =   2640
      Width           =   735
   End
   Begin VB.Label Label5 
      BackColor       =   &H00FF80FF&
      Caption         =   "籍贯"
      Height          =   495
      Left            =   2280
      TabIndex        =   8
      Top             =   1800
      Width           =   735
   End
   Begin VB.Label Label4 
      BackColor       =   &H00FF80FF&
      Caption         =   "性别"
      Height          =   495
      Left            =   480
      TabIndex        =   6
      Top             =   1800
      Width           =   615
   End
   Begin VB.Label Label3 
      BackColor       =   &H00FF80FF&
      Caption         =   "年龄"
      Height          =   495
      Left            =   4440
      TabIndex        =   4
      Top             =   1080
      Width           =   495
   End
   Begin VB.Label Label2 
      BackColor       =   &H00FF80FF&
      Caption         =   "姓名"
      Height          =   495
      Left            =   2280
      TabIndex        =   2
      Top             =   1080
      Width           =   735
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FF80FF&
      Caption         =   "学号"
      Height          =   495
      Left            =   480
      TabIndex        =   1
      Top             =   1080
      Width           =   735
   End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error Resume Next
Command3.Enabled = ture
If Command1.Caption = "添加" Then
Command1.Caption = "完成"
Data1.Recordset.AddNew
Text1.SetFocus
Else
Data1.Recordset.Update
Data1.Recordset.MoveLast
End If
End Sub

Private Sub Command2_Click()
Form4.Hide
Form2.Show

End Sub

Private Sub Command3_Click()
On Error Resume Next
Data1.Recordset.Delete
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then Data1.Recordset.MoveLast

End Sub

Private Sub Command4_Click()
On Error Resume Next

Command1.Enabled = ture: Command3.Enabled = ture
If Command4.Caption = "修改" Then
Command4.Caption = "确认"
Data1.Recordset.Edit
Text1.SetFocus
Else
Command4.Caption = "修改"

Data1.Recordset.Update
End If

End Sub

Private Sub Command5_Click()
Dim mno As String
mno = InputBox$("请输入快乐之星的密码", "搜索快乐之星")
Data1.Recordset.FindFirst "学号='" & mno & "'"
If Data1.Recordset.NoMatch Then MsgBox "无此学号!", , "真遗憾"

End Sub

Private Sub Data1_Validate(Action As Integer, Save As Integer)
If Text1.Text = "" And (Action = 6 Or Text1.DataChanged) Then
MsgBox "数据不完整,必须要有学号!"
Data1.UpdateControls
End If
If Action >= 1 And Action <= 4 Then
Command1.Enabled = True: Command2.Enabled = True
Command3.Enabled = True
End If
End Sub

Private Sub data1_Reposition()
Data1.Caption = Data1.Recordset.AbsolutePosition + 1


End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -