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

📄 course.frm

📁 一个简单的VB开发环境的学生管理系统.请各位大虾们多多指教
💻 FRM
📖 第 1 页 / 共 4 页
字号:
            Name            =   "楷体_GB2312"
            Size            =   21.75
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C000C0&
         Height          =   735
         Left            =   -75000
         TabIndex        =   30
         Top             =   5280
         Width           =   5775
      End
      Begin VB.Label Labelcancel1 
         BackStyle       =   0  'Transparent
         Caption         =   "取消"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   42
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C000C0&
         Height          =   855
         Left            =   7320
         TabIndex        =   28
         Top             =   6600
         Width           =   2295
      End
      Begin VB.Label Labelmod 
         BackStyle       =   0  'Transparent
         Caption         =   "修改"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   42
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C000C0&
         Height          =   855
         Left            =   840
         TabIndex        =   27
         Top             =   6600
         Width           =   2535
      End
      Begin VB.Image Image1 
         Height          =   600
         Left            =   8160
         Picture         =   "course.frx":3422
         Top             =   3960
         Width           =   1365
      End
      Begin VB.Label Label6 
         BackStyle       =   0  'Transparent
         Caption         =   "请输入要修改的课程名称:"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   15.75
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C000C0&
         Height          =   495
         Left            =   240
         TabIndex        =   16
         Top             =   4080
         Width           =   4455
      End
      Begin VB.Label Labelcancel 
         Caption         =   "取消"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   42
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C000C0&
         Height          =   1335
         Left            =   -66600
         TabIndex        =   14
         Top             =   6240
         Width           =   2415
      End
      Begin VB.Label Labeladd 
         Caption         =   "添加"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   42
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C000C0&
         Height          =   1095
         Left            =   -73920
         TabIndex        =   13
         Top             =   6240
         Width           =   2415
      End
   End
End
Attribute VB_Name = "courses"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public rs As ADODB.Recordset

Private Sub Image1_Click()
            Adodc2.CommandType = adCmdText
                Adodc2.RecordSource = "select * from 课程表 order by 课程编号 "
                    Adodc2.Refresh
            Set rs = Adodc2.Recordset
                With rs
                    Do While Not .EOF
                        If Trim(.Fields("课程名称")) = Trim(txtkeming1) Then
                                DataGrid2.Refresh
                                    Exit Sub
                        Else
                                .MoveNext
                        End If
                    Loop
                            MsgBox "没有你要修改的课程名称!"
                End With
                End Sub
Private Sub Image2_Click()
                                Adodc3.CommandType = adCmdText
                                Adodc3.RecordSource = "select * from 课程表 order by 课程编号"
                            Adodc3.Refresh
                                    Set rs = Adodc3.Recordset
                                With rs
                                        Do While Not .EOF
                                                If Trim(.Fields("课程名称")) = Trim(txtkeming3) Then
                                                
                                                    DataGrid3.Refresh
                                                                            Exit Sub
                                                Else
                                                                .MoveNext
                                                End If
                                        Loop
                                    MsgBox "没有你要删除的课程名称!"
                                End With
End Sub

Private Sub Labelcancel1_Click()
Unload Me
MDIFrm.Show
End Sub

Private Sub Labelcancel3_Click()
Unload Me
MDIFrm.Show
End Sub

Private Sub Labeldel_Click()
                        If Trim(txtkeming3) = "" Then
                                    MsgBox "课程名称不能为空,请输入课程名称!"
                                                        txtkeming3.SetFocus
                                                     Exit Sub
                        End If
                            Adodc3.CommandType = adCmdText
                                Adodc3.RecordSource = "select 课程名称 from 课程表 "
                                        Adodc3.Refresh
                                             Set rs = Adodc3.Recordset
                                             With rs
                                        Do While Not .EOF
                                                    If Trim(.Fields("课程名称")) = Trim(txtkeming3) Then
                                                             .Delete
                                                                    Adodc3.Refresh: DataGrid3.Refresh
                                                        MsgBox "删除课程信息成功!"
                                                                   DataGrid3.Refresh
                                                    Else
                                                            .MoveNext
                                                    End If
                                        Loop
                                    End With
End Sub

Private Sub Labelmod_Click()
Dim r As String
On Error Resume Next
                        If Trim(txtkebian1) = "" Or Not IsNumeric(txtkebian1) Then
                             MsgBox "课程编号为空或有非法字符!请输入课程编号!"
                                            txtkebian.SetFocus
                                                              Exit Sub
                        End If
                                If Trim(txtkeming1) = "" Then
                                            MsgBox "课程名称不能为空,请输入课程名称!"
                                        txtkeming1.SetFocus
                                                            Exit Sub
                                End If
                            If Trim(txtkeshi1) = "" Or Not IsNumeric(txtkeshi1) Then
                                     MsgBox "课时数为空或也有非法字符!请输入课时数!"
                                            txtkeshi1.SetFocus
                                                                Exit Sub
                            End If
                                    If Trim(txttype1) = "" Then
                                            MsgBox "课程类型不能为空,请输入课程类型!"
                                                            txttype1.SetFocus
                                                                                Exit Sub
                                    End If
                                If Trim(txtteacher1) = "" Then
                                              MsgBox "任课老师不能为空,请输入任课老师!"
                                          txtteacher1.SetFocus
                                                                  Exit Sub
                                End If
                                            Adodc2.CommandType = adCmdText
                                    Adodc2.RecordSource = "select * from 课程表"
                                            Set rs = Adodc2.Recordset

                                    With rs
                       Do While Not (.EOF)
                       If Trim(rs.Fields("课程名称")) = Trim(txtkeming1) Then
                                                            .Fields("课程编号") = Trim(txtkebian1)
                                                             .Fields("课程名称") = Trim(txtkeming1)
                                                            .Fields("课程类型") = Trim(txttype1)
                                                            .Fields("任课老师") = Trim(txtteacher1)
                                                             .Fields("课时数") = Trim(txtkeshi1)
                                                            .Update
                                        r = MsgBox("修改课程信息成功,是否继续其他操作?", vbOKCancel + vbExclamation, "提示信息")
                                       If r = vbOK Then
                                        txtkebian1 = "": txtkeming1 = "": txtkeshi1 = "": txttype1 = "": txtteacher1 = "": txtkebian.SetFocus
                                                                     Exit Sub

                                        Else
                                                .MoveNext
                                        End If
                     End If
                           Loop
                                    End With
         r = MsgBox("没有你要修改的课程名称,请从新输入", vbOKCancel + vbExclamation, "提示信息")
            If r = vbOK Then
                     txtkeming1 = ""
                              txtkeming1.SetFocus
                                   Exit Sub
            End If

End Sub

Private Sub Labeladd_Click()
Dim r As String
On Error Resume Next
                   If Trim(txtkebian) = "" Or Not IsNumeric(txtkebian) Then
                               MsgBox "课程编号为空或有非法字符!请输入课程编号!"
                                             txtkebian.SetFocus
                                    Exit Sub
                              End If
                                     If Trim(txtkeming) = "" Then
                                        MsgBox "课程名称不能为空,请输入课程名称!"
                                         txtkeming.SetFocus
                                                   Exit Sub
                                       End If
                                    If Trim(txtkeshi) = "" Or Not IsNumeric(txtkeshi) Then
                                                 MsgBox "课时数为空或也有非法字符!请输入课时数!"
                                                            txtkeshi.SetFocus
                                                     Exit Sub
                                    End If
                                        If Trim(txttype) = "" Then
                                                        MsgBox "课程类型不能为空,请输入课程类型!"
                                                        txttype.SetFocus
                                                     Exit Sub
                                        End If
                                If Trim(txtteacher) = "" Then
                                                MsgBox "任课老师不能为空,请输入任课老师!"
                                                          txtteacher.SetFocus
                                                                         Exit Sub
                                    End If
                                    Adodc1.CommandType = adCmdText
                                    Adodc1.RecordSource = "select * from 课程表 order by 课程编号"
                                        Adodc1.Refresh
                                        Set rs = Adodc1.Recordset
                                                With rs
                                            Do While Not (.EOF)
                                                    If Trim(rs.Fields("课程编号")) = Trim(txtkebian) Then
                                                        MsgBox "课程编号已存在,请从新输入课程编号!", vbOKCancel + vbExclamation, "提示信息"
                                                                 txtkebian = "": txtkebian.SetFocus: Exit Sub
                                                    End If
                         If Trim(rs.Fields("课程名称")) = Trim(txtkeming) Then
                                 MsgBox "课程名称已存在,请从新输入课程名称!", vbOKCancel + vbExclamation, "提示信息"
                                             txtkeming = "": txtkeming.SetFocus: Exit Sub
                             Else
                                      .MoveNext
                                    End If
                             Loop
                 .AddNew
                 .Fields("课程编号") = Trim(txtkebian)
                    .Fields("课程名称") = Trim(txtkeming)
                     .Fields("课程类型") = Trim(txttype)
                         .Fields("任课老师") = Trim(txtteacher)
                    .Fields("课时数") = Trim(txtkeshi)
                     .Update
                Adodc1.RecordSource = "select * from 课程表 order by  课程编号"
                        Adodc1.Refresh
             r = MsgBox("添加课程信息成功,是否继续其他操作?", vbOKCancel + vbExclamation, "提示信息")
                 If r = vbOK Then
                        txtkebian = "": txtkeming = "": txtkeshi = "": txttype = "": txtteacher = "": txtkebian.SetFocus
                                                Exit Sub
                    End If
        End With
End Sub

Private Sub labelcancel_Click()
Unload Me
MDIFrm.Show
End Sub


⌨️ 快捷键说明

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