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

📄 frmcjlr.frm

📁 毕业设计的学生成绩管理
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{DD44C0E7-B2CF-11D1-8DD3-444553540000}#1.0#0"; "CELL32.OCX"
Begin VB.Form FrmCjlr 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "成绩录入与修改"
   ClientHeight    =   6405
   ClientLeft      =   120
   ClientTop       =   1530
   ClientWidth     =   10350
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6405
   ScaleWidth      =   10350
   Begin VB.CommandButton Command3 
      Caption         =   "返回(&X)"
      Height          =   375
      Left            =   8520
      TabIndex        =   9
      Top             =   2520
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "保存成绩(&S)"
      Height          =   375
      Left            =   8520
      TabIndex        =   8
      Top             =   1920
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "录入修改(&I)"
      Height          =   375
      Left            =   8520
      TabIndex        =   7
      Top             =   1320
      Width           =   1335
   End
   Begin CELLLib.Cell Cell1 
      Height          =   5295
      Left            =   120
      TabIndex        =   6
      Top             =   960
      Width           =   8175
      _Version        =   65536
      _ExtentX        =   14420
      _ExtentY        =   9340
      _StockProps     =   0
      TopLabelVisible =   0   'False
      SideLabelVisible=   0   'False
      PageLabelVisible=   0   'False
   End
   Begin VB.Frame Frame1 
      Caption         =   "成绩录入对象"
      Height          =   735
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   10095
      Begin VB.TextBox Text2 
         Height          =   270
         Left            =   9240
         TabIndex        =   5
         Top             =   315
         Width           =   735
      End
      Begin VB.TextBox Text1 
         Height          =   270
         Left            =   7440
         TabIndex        =   4
         Text            =   "2000"
         Top             =   315
         Width           =   975
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   840
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   320
         Width           =   1815
      End
      Begin VB.ComboBox Combo2 
         Height          =   300
         Left            =   3480
         Style           =   2  'Dropdown List
         TabIndex        =   2
         Top             =   320
         Width           =   1695
      End
      Begin VB.ComboBox Combo5 
         Height          =   300
         ItemData        =   "FrmCjlr.frx":0000
         Left            =   6000
         List            =   "FrmCjlr.frx":001C
         Style           =   2  'Dropdown List
         TabIndex        =   3
         Top             =   320
         Width           =   615
      End
      Begin VB.Label Label5 
         Caption         =   "班级:"
         Height          =   255
         Left            =   8640
         TabIndex        =   14
         Top             =   360
         Width           =   615
      End
      Begin VB.Label Label1 
         Caption         =   "年级:"
         Height          =   255
         Left            =   6840
         TabIndex        =   13
         Top             =   360
         Width           =   615
      End
      Begin VB.Label Label2 
         Caption         =   "系别:"
         Height          =   255
         Left            =   240
         TabIndex        =   12
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label3 
         Caption         =   "专业:"
         Height          =   255
         Left            =   2880
         TabIndex        =   11
         Top             =   360
         Width           =   615
      End
      Begin VB.Label Label4 
         Caption         =   "学期:"
         Height          =   255
         Left            =   5400
         TabIndex        =   10
         Top             =   360
         Width           =   615
      End
   End
End
Attribute VB_Name = "FrmCjlr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public bCellDataModified As Boolean
'成绩修改标志

'***************************************************************************************
'  过程:Cell1_OnCellChange
'  功能:录入新成绩时设置修改标志
'  参数:
'       oldcol:旧列号
'       oldrow:旧行号
'       newcol:新列号(未用)
'       newrow:新行号(未用)
'***************************************************************************************
Private Sub Cell1_OnCellChange(ByVal oldcol As Long, ByVal oldrow As Long, ByVal newcol As Long, ByVal newrow As Long)
    If oldcol > 1 And oldrow > 1 Then
        bCellDataModified = True
    End If
End Sub
'***************************************************************************************
'  函数:fGetCellData
'  功能:获取成绩值
'  参数:
'       col:列号
'       row:行号
'       objCell:Cell控件
'  返回值:Variant型结果
'***************************************************************************************
Private Function fGetCellData(ByVal col As Long, ByVal row As Long, ByRef objCell As Object) As Variant
    Dim vData As Variant
    Dim numType As Integer
    Dim btemp As Boolean
    numType = objCell.DoGetCellDataType(col, row)
    If numType = 1 Then
        MsgBox Trim(Str(row)) & "行" & Trim(Str(col)) & "列数据类型不匹配,期待值为数字型!", vbCritical, "错误信息"
        fGetCellData = 0
    Else
        btemp = objCell.DoGetCellData(col, row, vData)
        fGetCellData = vData
    End If
End Function

'***************************************************************************************
'  函数:fGetCellString
'  功能:获取成绩值
'  参数:
'       col:列号
'       row:行号
'       objCell:Cell控件
'  返回值:String型结果
'***************************************************************************************
Private Function fGetCellString(ByVal col As Long, ByVal row As Long, ByRef objCell As Object) As String
    Dim vData As Variant
    Dim numType As Integer
    Dim btemp As Boolean
    btemp = objCell.DoGetCellData(col, row, vData)
    fGetCellString = vData
End Function

'***************************************************************************************
'  过程:Command1_Click
'  功能:录入或修改成绩
'***************************************************************************************
Private Sub Command1_Click()
    Dim objRs1 As ADODB.Recordset
    Dim numI As Integer, numcol As Integer, numRow As Integer
    Dim bFlag As Boolean
    Dim strExec As String, strTemp As String, strtemp1 As String
    If Combo1.Text = "" Or Combo2.Text = "" Or Combo5.Text = "" Or Text1.Text = "" Then
'   系别、专业、学期或年级信息不全
        MsgBox "您所指定的对象信息不全,无法录入成绩!", vbCritical, "错误信息"
    Else
        If bCellDataModified Then
'       由于重置成绩内容,要求用户确认放弃与否原有数据
            If MsgBox("您放弃已经录入的数据吗?", vbYesNo, "系统信息") = vbYes Then
                bFlag = True
                bCellDataModified = False
            Else
                bFlag = False
            End If
        Else
            bFlag = True
        End If
        If bFlag Then   '没有录入数据或放弃输入的数据
            Set objRs = objCon.Execute("Select * From XKQKB Where kcbmc='" & _
                fSckcbmc(Text1.Text, Combo1.Text, Combo2.Text, Combo5.Text) & "'")
'           根据系别(Combo1)、专业(Combo2)、年级(Text1)和学期(Combo5),从选课情况表查询选课情况
            If Not objRs.EOF Then
                Cell_Setup Cell1
                Cell1.DoAppendRow 2
'               添加两行,显示表头
                Cell1.DoAppendCol 1
                Cell1.DoSetCellString 0, 0, "学号"
                Cell1.DoSetColWidth 0, 80
                Cell1.DoSetCellAlignment 0, 0, 36
'               居中显示
                Cell1.DoSetCellReadOnly 0, 0, True
'               表头内容为只读
                Cell1.DoAppendCol 1
                Cell1.DoSetCellString 1, 0, "姓名"
                Cell1.DoSetCellAlignment 1, 0, 36
                Cell1.DoSetCellReadOnly 1, 0, True
                Cell1.DoJoinCells 0, 0, 0, 1
                Cell1.DoJoinCells 1, 0, 1, 1
'               由于课程名和课程计分形式各占一行,表头中的“学号”和“姓名”将同列的两行合并
                numcol = 2
'               列编号
                For numI = 1 To 10
                    If objRs("kcbh" & Trim(Str(numI))) <> "" Then
'                   第numI个课程为已排定的课程
                        Cell1.DoAppendCol 1
                        Cell1.DoSetCellString numcol, 0, Trim(fGetKcmc(objRs("kcbh" & Trim(Str(numI)))))
'                       显示课程名称(由fGetKcmc(课程编号)获得)
                        Cell1.DoSetCellAlignment numcol, 0, 36
                        Cell1.DoSetCellReadOnly numcol, 0, True
                        Select Case Trim(objRs("pffs" & Trim(Str(numI))))
'                       根据该课程的评分方式,形成表头内容
                            Case "0"
'                           "总成绩"型评分方式
                                Cell1.DoSetCellString numcol, 1, "总成绩"
                                Cell1.DoSetCellAlignment numcol, 1, 36
                                Cell1.DoSetCellReadOnly numcol, 1, True
                            Case "1"
'                           "理论成绩+实训成绩=总成绩"型评分方式
                                Cell1.DoAppendCol 2
                                Cell1.DoJoinCells numcol, 0, numcol + 2, 0

⌨️ 快捷键说明

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