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

📄 frmlesson.frm

📁 学生学籍管理系统是一个教育单位不可缺少的部分,它的内容对于学校的决策者和管理者来说都至关重要,所以学生学籍管理系统应该能够为用户提供充足的信息和快捷的查询手段。但一直以来人们使用传统人工的方式管理文件
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmlesson 
   BorderStyle     =   1  '虫絬㏕﹚
   Caption         =   "课程设置"
   ClientHeight    =   5235
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   6435
   Icon            =   "frmlesson.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5235
   ScaleWidth      =   6435
   StartUpPosition =   1  '┮妮跌怠いァ
   Begin VB.Frame Frame1 
      Caption         =   "课程设置"
      Height          =   5055
      Index           =   0
      Left            =   120
      TabIndex        =   8
      Top             =   120
      Width           =   6255
      Begin VB.TextBox Text1 
         Enabled         =   0   'False
         Height          =   300
         Left            =   1440
         TabIndex        =   0
         Top             =   3240
         Width           =   1575
      End
      Begin VB.TextBox Text2 
         Enabled         =   0   'False
         Height          =   315
         Left            =   1440
         TabIndex        =   1
         Top             =   3600
         Width           =   1695
      End
      Begin VB.Frame Frame1 
         Caption         =   "课程安排及教学计划"
         Height          =   855
         Index           =   2
         Left            =   240
         TabIndex        =   9
         Top             =   4080
         Width           =   4335
         Begin VB.TextBox Text3 
            BeginProperty DataFormat 
               Type            =   1
               Format          =   "0"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   1
            EndProperty
            Enabled         =   0   'False
            Height          =   315
            Left            =   840
            TabIndex        =   2
            Top             =   360
            Width           =   975
         End
         Begin VB.TextBox Text4 
            Enabled         =   0   'False
            Height          =   315
            Left            =   3240
            TabIndex        =   3
            Top             =   360
            Width           =   975
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            Caption         =   "总课时:"
            Height          =   180
            Left            =   120
            TabIndex        =   11
            Top             =   420
            Width           =   720
         End
         Begin VB.Label Label9 
            AutoSize        =   -1  'True
            Caption         =   "学分:"
            Height          =   180
            Left            =   2640
            TabIndex        =   10
            Top             =   420
            Width           =   540
         End
      End
      Begin MSAdodcLib.Adodc Adodc1 
         Height          =   330
         Left            =   4800
         Top             =   5640
         Visible         =   0   'False
         Width           =   1200
         _ExtentX        =   2117
         _ExtentY        =   582
         ConnectMode     =   0
         CursorLocation  =   3
         IsolationLevel  =   -1
         ConnectionTimeout=   15
         CommandTimeout  =   30
         CursorType      =   3
         LockType        =   3
         CommandType     =   8
         CursorOptions   =   0
         CacheSize       =   50
         MaxRecords      =   0
         BOFAction       =   0
         EOFAction       =   0
         ConnectStringType=   1
         Appearance      =   1
         BackColor       =   -2147483643
         ForeColor       =   -2147483640
         Orientation     =   0
         Enabled         =   -1
         Connect         =   ""
         OLEDBString     =   ""
         OLEDBFile       =   ""
         DataSourceName  =   "student"
         OtherAttributes =   ""
         UserName        =   ""
         Password        =   ""
         RecordSource    =   ""
         Caption         =   "Adodc1"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         _Version        =   393216
      End
      Begin VB.CommandButton Command1 
         Caption         =   "退出"
         Height          =   375
         Left            =   4920
         TabIndex        =   7
         Top             =   4560
         Width           =   1095
      End
      Begin VB.CommandButton Command2 
         Caption         =   "添加"
         Height          =   375
         Left            =   4920
         TabIndex        =   4
         Top             =   3120
         Width           =   1095
      End
      Begin VB.CommandButton Command3 
         Caption         =   "删除"
         Height          =   375
         Left            =   4920
         TabIndex        =   6
         Top             =   4080
         Width           =   1095
      End
      Begin VB.CommandButton Command4 
         Caption         =   "修改"
         Height          =   375
         Left            =   4920
         TabIndex        =   5
         Top             =   3600
         Width           =   1095
      End
      Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
         Height          =   2775
         Left            =   120
         TabIndex        =   13
         Top             =   240
         Width           =   5955
         _ExtentX        =   10504
         _ExtentY        =   4895
         _Version        =   393216
         FixedCols       =   0
         BackColorBkg    =   16777215
         AllowUserResizing=   1
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "课程代码:"
         Height          =   180
         Left            =   360
         TabIndex        =   14
         Top             =   3300
         Width           =   900
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "课 程 名:"
         Height          =   180
         Left            =   360
         TabIndex        =   12
         Top             =   3660
         Width           =   900
      End
   End
   Begin VB.Menu m1 
      Caption         =   "课程设置(&C)"
      Visible         =   0   'False
      Begin VB.Menu m01 
         Caption         =   "添加新课程(&A)"
      End
      Begin VB.Menu m03 
         Caption         =   "修改所选课程(&M)"
      End
      Begin VB.Menu m05 
         Caption         =   "-"
      End
      Begin VB.Menu m02 
         Caption         =   "删除所选课程(&D)"
      End
   End
End
Attribute VB_Name = "frmlesson"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command2_Click()
If Command2.Caption = "确定" Then
  
  If Text1.Text = "" Then
     MsgBox "课程代码不能为空!", vbOKOnly + vbExclamation, "警告"
     Text1.SetFocus
     Exit Sub
  End If
  
  If Text2.Text = "" Then
     MsgBox "课程名称不能为空!", vbOKOnly + vbExclamation, "警告"
     Text2.SetFocus
     Exit Sub
  End If
  
  If Not IsNumeric(Text3.Text) Then
      MsgBox "课时必须为数字!", vbOKOnly + vbExclamation, "警告"
     Text3.SetFocus
     Exit Sub
  End If
    
  If Text4.Text = "" Then
    MsgBox "学分不能为空!", vbOKOnly + vbExclamation, "警告"
    Text4.SetFocus
    Exit Sub
  End If
    
  Adodc1.RecordSource = "select * from lesson where ID='" & Trim(Me.MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)) & "'"
  Adodc1.Refresh
   If Adodc1.Recordset.EOF = False Then
     MsgBox "已经存在该课程!", vbOKOnly + vbExclamation, "警告"
     Text1.SetFocus
     Text1.SelStart = 0
     Text1.SelLength = Len(Text2.Text)
     Exit Sub
   Else
     Adodc1.Recordset.AddNew
     Adodc1.Recordset.Fields(0) = Text1.Text
     Adodc1.Recordset.Fields(1) = Text2.Text
     Adodc1.Recordset.Fields(2) = Text3.Text
     Adodc1.Recordset.Fields(3) = Text4.Text
     Adodc1.Recordset.Update
   
     Text1.Text = ""
     Text2.Text = ""
     Text3.Text = ""
     Text4.Text = ""
     InitTitle
     InitData
   
   Command2.Caption = "添加"
   m01.Caption = "添加新课程"
   Command4.Enabled = True
   Command3.Enabled = True
   m03.Enabled = True
   m02.Enabled = True
   Text1.Enabled = False
   Text2.Enabled = False
   Text3.Enabled = False
   Text4.Enabled = False
  End If
Else
   Text1.Enabled = True
   Text2.Enabled = True
   Text3.Enabled = True
   Text4.Enabled = True
   
   Text1.Text = ""
   Text2.Text = ""
   Text3.Text = ""
   Text4.Text = ""
   Text1.SetFocus
   
   InitTitle
   InitData
   Command2.Caption = "确定"
   m01.Caption = "确定添加 "
   m03.Enabled = False
   m02.Enabled = False
   Command4.Enabled = False
   Command3.Enabled = False
End If
End Sub

Private Sub Command3_Click()
  If Trim(Me.MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)) = "" Then
   MsgBox "你还没有选择记录!", vbOKOnly + vbExclamation, "警告"
Else
  If MsgBox("确定要删除 课程代码 为 " & Trim(Me.MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)) & " 的记录吗?", vbYesNo + vbExclamation, "警告") = vbYes Then
  Adodc1.RecordSource = "select * from lesson where ID='" & Trim(Me.MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)) & "'"
  Adodc1.Refresh
  Adodc1.Recordset.Delete
  
  Text1.Text = ""
  Text2.Text = ""
  Text3.Text = ""
  Text4.Text = ""
  
  InitTitle
  InitData
  End If
End If
End Sub

Private Sub Command4_Click()
  If Trim(Me.MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)) = "" Then
    MsgBox "你还没有选择记录!", vbOKOnly + vbExclamation, "警告"
  Else
    If Command4.Caption = "确定" Then
  
  If Text1.Text = "" Then
     MsgBox "课程代码不能为空!", vbOKOnly + vbExclamation, "警告"
     Text1.SetFocus
     Exit Sub
  End If
  
  If Text2.Text = "" Then
     MsgBox "课程名称不能为空!", vbOKOnly + vbExclamation, "警告"
     Text2.SetFocus
     Exit Sub
  End If
  
  If Not IsNumeric(Text3.Text) Then
      MsgBox "课时必须为数字!", vbOKOnly + vbExclamation, "警告"
     Text3.SetFocus
     Exit Sub
  End If
    
  If Text4.Text = "" Then
    MsgBox "学分不能为空!", vbOKOnly + vbExclamation, "警告"
    Text4.SetFocus
    Exit Sub
  End If
    
  Adodc1.RecordSource = "select * from lesson where ID='" & Trim(Me.MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)) & "'"
  Adodc1.Refresh
   Adodc1.Recordset.Fields(0) = Text1.Text
   Adodc1.Recordset.Fields(1) = Text2.Text
   Adodc1.Recordset.Fields(2) = Text3.Text
   Adodc1.Recordset.Fields(3) = Text4.Text
   
   Adodc1.Recordset.Update
   Text1.Text = ""
   Text2.Text = ""
   Text3.Text = ""
   Text4.Text = ""
   InitTitle
   InitData
   Command4.Caption = "修改"
   m03.Caption = "修改所选课程"
   Command2.Enabled = True
   Command3.Enabled = True
   m01.Enabled = True
   m02.Enabled = True
   Text1.Enabled = False
   Text2.Enabled = False
   Text3.Enabled = False
   Text4.Enabled = False
Else
   Text1.Enabled = True
   Text2.Enabled = True
   Text3.Enabled = True
   Text4.Enabled = True
   Text1.SetFocus
   Command4.Caption = "确定"
   m03.Caption = "确定修改"
   m01.Enabled = False
   m02.Enabled = False
   Command2.Enabled = False
   Command3.Enabled = False
End If
End If
End Sub

Private Sub Command1_Click()
  Unload Me
End Sub

Private Sub Form_Load()
  Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path + "\student.mdb"
  'Adodc1.ConnectionString = "driver={sql server};server=LTX\TEMPT;database=student;uid=sa;pwd=5059"
  InitTitle
  InitData
End Sub

Public Sub InitTitle()
  MSFlexGrid1.Clear
  MSFlexGrid1.FormatString = "^ 代码 |^课程名称|^ 课时|^  学分"
  With MSFlexGrid1
    
    .ColWidth(0) = 500
    .ColWidth(1) = 3000
    .ColWidth(2) = 1000
    .ColWidth(3) = 1000
   
    .RowHeightMin = 300
    .Col = 0
    .Row = 0
    .RowSel = 1
    .ColSel = .Cols - 1
    .Row = 1
    End With
End Sub

Public Sub InitData()
Dim i As Integer

Adodc1.RecordSource = "select * from lesson order by ID"
Adodc1.Refresh
 If Adodc1.Recordset.EOF = False Then
   Adodc1.Recordset.MoveFirst
   With MSFlexGrid1
   .Rows = 3
     .Row = 2
   
    Do While Not Adodc1.Recordset.EOF
     .Rows = .Rows + 1
     For i = 1 To Adodc1.Recordset.Fields.Count
      .TextMatrix(.Row - 1, i - 1) = Adodc1.Recordset.Fields(i - 1)
     Next i
     .Row = .Row + 1
     Adodc1.Recordset.MoveNext
    Loop
 End With
End If
End Sub

Private Sub m01_Click()
   'add
    Command2_Click
End Sub

Private Sub m02_Click()
    'delete
    Command3_Click
End Sub

Private Sub m03_Click()
   'modify
    Command4_Click
End Sub

Private Sub MSFlexGrid1_Click()
   If Trim(Me.MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)) = "" Then
   Text1.Text = ""
   Text2.Text = ""
   Text3.Text = ""
   Text4.Text = ""
Else
  Adodc1.RecordSource = "select * from lesson where ID='" & Trim(Me.MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)) & "'"
  Adodc1.Refresh
   Text1.Text = Adodc1.Recordset.Fields(0)
   Text2.Text = Adodc1.Recordset.Fields(1)
   Text3.Text = Adodc1.Recordset.Fields(2)
   Text4.Text = Adodc1.Recordset.Fields(3)
End If
End Sub

Private Sub MSFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
   If Button = 2 Then
      PopupMenu m1
   End If
End Sub

⌨️ 快捷键说明

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