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

📄 form1.frm

📁 一个小小的学生管理系统
💻 FRM
📖 第 1 页 / 共 3 页
字号:
      Begin VB.Label Label2 
         Caption         =   "年龄:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5040
         TabIndex        =   32
         Top             =   3840
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "学号:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   720
         TabIndex        =   31
         Top             =   3840
         Width           =   855
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mbookmark1
Dim mbookmark2
Dim mbookmark3

Private Sub command1_click()
    On Error Resume Next
    Command2.Enabled = Not Command2.Enabled
    Command3.Enabled = Not Command3.Enabled
    Command4.Enabled = Not Command4.Enabled
    Command5.Enabled = Not Command5.Enabled
   If Command1.Caption = "添加" Then
        Command1.Caption = "确认"
        mbookmark1 = Data1.Recordset.Bookmark
        Data1.Recordset.AddNew
        Text1.SetFocus
    ElseIf Command1.Caption = "确认" Then
        Data1.Recordset.Update
        Data1.Recordset.MoveLast
        Command1.Caption = "刷新"
    ElseIf Command1.Caption = "刷新" Then
        Data1.Refresh
    End If
End Sub

Private Sub Command16_Click()
Data1.Refresh
End Sub

Private Sub Command17_Click()
Data1.Refresh
End Sub

Private Sub Command18_Click()
Data1.Refresh
End Sub

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

Private Sub Command3_Click()
On Error Resume Next
    Command1.Enabled = Not Command1.Enabled
    Command2.Enabled = Not Command2.Enabled
    Command4.Enabled = Not Command4.Enabled
    Command5.Enabled = Not Command5.Enabled
   If Command3.Caption = "修改" Then
        mbookmark1 = Data1.Recordset.Bookmark
        Command3.Caption = "确认"
        Data1.Recordset.Edit
        Text1.SetFocus
    Else
        Command3.Caption = "修改"
        Data1.Recordset.Update
    End If
   Data1.Refresh
End Sub

Private Sub Command4_Click()
    On Error Resume Next
    Command1.Caption = "新增": Command3.Caption = "修改"
    Command1.Enabled = True: Command2.Enabled = True
    Command3.Enabled = True: Command4.Enabled = False
    Command5.Enabled = True
    Data1.UpdateControls
    Data1.Recordset.Bookmark = mbookmark1
    Data1.Refresh
End Sub

Private Sub Command5_Click()
    mno = InputBox$("请输入学号", "查找窗")
    Data1.Recordset.FindFirst "学号 = '" & mno & "'"
    If Data1.Recordset.NoMatch Then
    MsgBox "查无此学号,请核对后重新输入!", , "提示"
    Else
    MsgBox "你要查询的学生信息!", , "OK!"
    End If
End Sub

Private Sub Data1_Reposition()
    Data1.Caption = "这是第" & (Data1.Recordset.AbsolutePosition + 1) & "条记录"
End Sub

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



Private Sub Command6_Click()
    On Error Resume Next
    Command7.Enabled = Not Command2.Enabled
    Command8.Enabled = Not Command3.Enabled
    Command9.Enabled = Not Command4.Enabled
    Command10.Enabled = Not Command5.Enabled
   If Command6.Caption = "添加" Then
        Command6.Caption = "确认"
        mbookmark2 = Data2.Recordset.Bookmark
        Data2.Recordset.AddNew
        Text7.SetFocus
    ElseIf Command6.Caption = "确认" Then
        Data2.Recordset.Update
        Data2.Recordset.MoveLast
        Command6.Caption = "刷新"
    ElseIf Command6.Caption = "刷新" Then
        Data2.Refresh
    End If
End Sub

Private Sub Command7_Click()
    On Error Resume Next
    Data2.Recordset.Delete
    Data2.Recordset.MoveNext
    If Data2.Recordset.EOF Then Data2.Recordset.MoveLast
    Data2.Refresh
End Sub

Private Sub Command8_Click()
On Error Resume Next
    Command6.Enabled = Not Command1.Enabled
    Command7.Enabled = Not Command2.Enabled
    Command9.Enabled = Not Command4.Enabled
    Command10.Enabled = Not Command5.Enabled
   If Command8.Caption = "修改" Then
        mbookmark2 = Data2.Recordset.Bookmark
        Command8.Caption = "确认"
        Data2.Recordset.Edit
        Text7.SetFocus
    Else
        Command8.Caption = "修改"
        Data2.Recordset.Update
    End If
    Data2.Refresh
End Sub

Private Sub Command9_Click()
    On Error Resume Next
    Command6.Caption = "新增": Command8.Caption = "修改"
    Command6.Enabled = True: Command7.Enabled = True
    Command8.Enabled = True: Command9.Enabled = False
    Command10.Enabled = True
    Data2.UpdateControls
    Data2.Recordset.Bookmark = mbookmark2
   Data2.Refresh
End Sub

Private Sub Command10_Click()
    mno = InputBox$("请输入你要查找的课程号:", "查找窗")
    Data2.Recordset.FindFirst "课程号 = '" & mno & "'"
    If Data2.Recordset.NoMatch Then
    MsgBox "查无此课程号!请核对后重新输入", , "提示"
    Else
    MsgBox "你要查询的学生信息!", , "OK!"
    End If
End Sub

Private Sub Data2_Reposition()
    Data2.Caption = "这是第" & (Data2.Recordset.AbsolutePosition + 1) & "条记录"
End Sub

Private Sub Data2_Validate(Action As Integer, Save As Integer)
    If Text7.Text = "" And (Action = 6 Or Text1.DataChanged) Then
        Data2.UpdateControls
    MsgBox "必须输入学号!"
    End If
    If Action >= 1 And Action < 5 Then
        Command6.Caption = "新增": Command8.Caption = "修改"
        Command6.Enabled = True: Command7.Enabled = True
        Command8.Enabled = True: Command9.Enabled = False
        Command10.Enabled = True
    End If
End Sub





Private Sub Command11_Click()
    On Error Resume Next
    Command12.Enabled = Not Command12.Enabled
    Command13.Enabled = Not Command13.Enabled
    Command14.Enabled = Not Command14.Enabled
    Command15.Enabled = Not Command15.Enabled
   If Command11.Caption = "添加" Then
        Command11.Caption = "确认"
        mbookmark3 = Data3.Recordset.Bookmark
        Data3.Recordset.AddNew
        Text12.SetFocus
    ElseIf Command11.Caption = "确认" Then
        Data3.Recordset.Update
        Data3.Recordset.MoveLast
        Command11.Caption = "刷新"
    ElseIf Command11.Caption = "刷新" Then
      Data3.Refresh
    End If
End Sub

Private Sub Command12_Click()
    On Error Resume Next
    Data3.Recordset.Delete
    Data3.Recordset.MoveNext
    If Data3.Recordset.EOF Then Data3.Recordset.MoveLast
    Data3.Refresh
End Sub

Private Sub Command13_Click()
On Error Resume Next
    Command11.Enabled = Not Command11.Enabled
    Command12.Enabled = Not Command12.Enabled
    Command14.Enabled = Not Command14.Enabled
    Command15.Enabled = Not Command15.Enabled
   If Command13.Caption = "修改" Then
        mbookmark3 = Data3.Recordset.Bookmark
        Command13.Caption = "确认"
        Data3.Recordset.Edit
        Text12.SetFocus
    Else
        Command13.Caption = "修改"
        Data3.Recordset.Update
    End If
    Data3.Refresh
End Sub

Private Sub Command14_Click()
    On Error Resume Next
    Command11.Caption = "新增": Command13.Caption = "修改"
    Command11.Enabled = True: Command12.Enabled = True
    Command13.Enabled = True: Command14.Enabled = False
    Command15.Enabled = True
    Data3.UpdateControls
    Data3.Recordset.Bookmark = mbookmark3
    Data3.Refresh
End Sub

Private Sub Command15_Click()
    mno = InputBox$("请输入你要查找的学号", "查找窗")
    Data3.Recordset.FindFirst "学号 = '" & mno & "'"
    If Data3.Recordset.NoMatch Then
    MsgBox "无此学号,请重新输入!", , "提示"
    Else
    MsgBox "你要查找的学生信息!", , "OK!"
    End If
End Sub

Private Sub Data3_Reposition()
        Data3.Caption = "这是第" & (Data3.Recordset.AbsolutePosition + 1) & "条记录"
End Sub

Private Sub Data3_Validate(Action As Integer, Save As Integer)
    If Text12.Text = "" And (Action = 6 Or Text1.DataChanged) Then
        Data3.UpdateControls
    MsgBox "必须输入学号!"
    End If
    If Action >= 1 And Action < 5 Then
        Command11.Caption = "新增": Command13.Caption = "修改"
        Command11.Enabled = True: Command12.Enabled = True
        Command13.Enabled = True: Command14.Enabled = False
        Command15.Enabled = True
    End If
End Sub

Private Sub Form_Load()
MSFlexGrid1.ColWidth(0) = 1200
MSFlexGrid1.ColWidth(1) = 1200
MSFlexGrid1.ColWidth(2) = 500
MSFlexGrid1.ColWidth(3) = 700
MSFlexGrid1.ColWidth(4) = 2500
MSFlexGrid2.ColWidth(0) = 1200
MSFlexGrid2.ColWidth(1) = 2000
MSFlexGrid2.ColWidth(2) = 1100
MSFlexGrid2.ColWidth(3) = 1350
MSFlexGrid3.ColWidth(0) = 2100
MSFlexGrid3.ColWidth(1) = 2040
MSFlexGrid3.ColWidth(2) = 1500
Data1.DatabaseName = (App.Path + "\student.mdb")
Data2.DatabaseName = (App.Path + "\student.mdb")
Data3.DatabaseName = (App.Path + "\student.mdb")
End Sub

⌨️ 快捷键说明

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