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

📄 formchengji.frm

📁 学生信息管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         TabIndex        =   9
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "课程"
         Height          =   255
         Index           =   9
         Left            =   240
         TabIndex        =   8
         Top             =   1320
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "成绩"
         Height          =   255
         Index           =   10
         Left            =   240
         TabIndex        =   7
         Top             =   2280
         Width           =   975
      End
   End
   Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
      Height          =   4575
      Left            =   240
      TabIndex        =   0
      Top             =   840
      Width           =   5895
      _ExtentX        =   10398
      _ExtentY        =   8070
      _Version        =   393216
      Cols            =   3
      BackColorBkg    =   16777215
      Appearance      =   0
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "                成     绩     信     息"
      Height          =   375
      Left            =   240
      TabIndex        =   28
      Top             =   480
      Width           =   9855
   End
End
Attribute VB_Name = "Formchengji"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Dim Mrc As ADODB.Recordset
Dim Msgtext As String
Dim txtSQL As String

Private Sub Command1_Click()
    If Not IsNumeric(Text1(0)) Then
        MsgBox "学号输入有误!", vbOKOnly, "提示"
        Text1(0).SetFocus
        Exit Sub
    End If
    If Text1(1) = "" Then
        MsgBox "课程不能为空!", vbOKOnly, "提示"
        Text1(1).SetFocus
        Exit Sub
    End If
    If Text1(2) = "" Then
        MsgBox "成绩不能为空!", vbOKOnly, "提示"
        Text1(2).SetFocus
        Exit Sub
    End If
    txtSQL = "select * from 成绩单 where 学号='" & Trim(Text1(0)) & "'and 课程='" & Trim(Text1(1)) & "'"
    Set Mrc = ExecuteSQL(txtSQL, Msgtext)
    If Mrc.EOF = False Then
        MsgBox "此同学本学科的成绩已存在!", vbOKOnly, "警告"
        Text1(0).SetFocus
        Exit Sub
    End If
    Mrc.Close
    txtSQL = "select * from 基本信息 where 学号='" & Trim(Text1(0).Text) & "'"
    Set Mrc = ExecuteSQL(txtSQL, Msgtext)
    If Mrc.EOF = True Then
        MsgBox "无此学号!", vbOKOnly + vbExclamation, "提示"
        Text1(0).SetFocus
        Exit Sub
    End If
    Mrc.Close
    txtSQL = "select * from 成绩单"
    Set Mrc = ExecuteSQL(txtSQL, Msgtext)
    Mrc.AddNew
    Mrc.Fields(0) = Trim(Text1(0))
    Mrc.Fields(1) = Trim(Text1(1))
    Mrc.Fields(2) = Trim(Text1(2))
    Mrc.Update
    Mrc.Close
    For i = 0 To 2
        Text1(i) = ""
    Next
    MsgBox "信息添加成功!", vbOKOnly, "提示"
    ShowData
End Sub

Private Sub Command2_Click()
    For i = 0 To 2
        Text1(i) = ""
    Next
End Sub

Private Sub Command3_Click()
    If Text1(5) = "" Then
        MsgBox "课程不能为空!", vbOKOnly, "提示"
        Text1(5).SetFocus
        Exit Sub
    End If
    If Text1(6) = "" Then
        MsgBox "成绩不能为空!", vbOKOnly, "提示"
        Text1(6).SetFocus
        Exit Sub
    End If
    txtSQL = "delete from 成绩单 where 学号='" & Trim(Text1(4)) & "'and 课程='" & Trim(Text1(5)) & "'"
    Set Mrc = ExecuteSQL(txtSQL, Msgtext)
    
    txtSQL = "select * from 成绩单"
    Set Mrc = ExecuteSQL(txtSQL, Msgtext)
    Mrc.AddNew
    Mrc.Fields(0) = Trim(Text1(4))
    Mrc.Fields(1) = Trim(Text1(5))
    Mrc.Fields(2) = Trim(Text1(6))
    Mrc.Update
    Mrc.Close
    For i = 4 To 6
        Text1(i) = ""
    Next
    MsgBox "信息修改成功!", vbOKOnly, "提示"
    ShowData
End Sub

Private Sub Command4_Click()
    For i = 4 To 6
        Text1(i) = ""
    Next
End Sub

Private Sub Command5_Click()
    txtSQL = "delete from 成绩单 where 学号='" & Trim(Text1(8)) & "'and 课程='" & Trim(Text1(9)) & "'"
    Set Mrc = ExecuteSQL(txtSQL, Msgtext)
   
    For i = 8 To 10
        Text1(i) = ""
    Next
    MsgBox "信息已经删除!", vbOKOnly, "警告"
    ShowData
End Sub

Private Sub Command6_Click()
    For i = 8 To 10
        Text1(i) = ""
    Next
End Sub

Private Sub Command7_Click()
   If Option1.Value = True Then
        If Not IsNumeric(Text1(12)) Then
            MsgBox "学号输入有误!", vbOKOnly + vbExclamation, "错误"
            Exit Sub
            Text1(12).SetFocus
        End If
        txtSQL = "select *  from 成绩单 where 学号='" & Trim(Text1(12)) & "' "
        Set Mrc = ExecuteSQL(txtSQL, Msgtext)
        If Mrc.EOF = True Then
            MsgBox "无此学号!", vbOKOnly + vbExclamation, "提示"
            Exit Sub
            Text1(12).SetFocus
        End If
    Else
        If Text1(13).Text = "" Then
            MsgBox "课程不能为空!", vbOKOnly + vbExclamation, "错误"
            Exit Sub
            Text1(13).SetFocus
        End If
        txtSQL = "select *  from 成绩单 where 课程='" & Trim(Text1(13)) & "' "
        Set Mrc = ExecuteSQL(txtSQL, Msgtext)
        If Mrc.EOF = True Then
            MsgBox "无此课程!", vbOKOnly + vbExclamation, "提示"
            Exit Sub
            Text1(13).SetFocus
        End If
    End If
    MSFlexGrid1.ColWidth(0) = 2000
    MSFlexGrid1.ColWidth(1) = 1200
    MSFlexGrid1.ColWidth(2) = 1200
    MSFlexGrid1.TextMatrix(0, 0) = "学号"
    MSFlexGrid1.TextMatrix(0, 1) = "课程"
    MSFlexGrid1.TextMatrix(0, 2) = "成绩"
    MSFlexGrid1.Rows = 1
            Do While Not Mrc.EOF
            MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
            For i = 0 To Mrc.Fields.Count - 1
                MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, i) = Mrc.Fields(i) & ""
            Next i
            Mrc.MoveNext
        Loop
    
    Mrc.Close
End Sub



Private Sub Form_Load()
    Picture1(1).Top = Picture1(0).Top
    Picture1(1).Left = Picture1(0).Left
    Picture1(2).Top = Picture1(0).Top
    Picture1(2).Left = Picture1(0).Left
    Picture1(3).Top = Picture1(0).Top
    Picture1(3).Left = Picture1(0).Left
    ShowData
End Sub
Private Sub Form_Resize()
    dColor.ZOrder 1
End Sub

Private Sub ShowData()
    Dim txSQL As String
    Dim Mrcc As ADODB.Recordset
    txSQL = "select * from 成绩单"
    Set Mrcc = ExecuteSQL(txSQL, Msgtext)
        With MSFlexGrid1
        .ColWidth(0) = 2000
        .ColWidth(1) = 1200
        .ColWidth(2) = 1200
        .TextMatrix(0, 0) = "学号"
        .TextMatrix(0, 1) = "课程"
        .TextMatrix(0, 2) = "成绩"
        .Rows = 1
        Do While Not Mrcc.EOF
            .Rows = .Rows + 1
            For i = 0 To Mrcc.Fields.Count - 1
                .TextMatrix(.Rows - 1, i) = Mrcc.Fields(i) & ""
            Next i
            Mrcc.MoveNext
        Loop
    End With
    Mrcc.Close
End Sub

Private Sub MSFlexGrid1_Click()
    If Picture1(1).Visible = True Then
        Text1(4) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0))
        Text1(5) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1))
        Text1(6) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2))
        Command3.Enabled = True
    End If
    If Picture1(2).Visible = True Then
        Text1(8) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0))
        Text1(9) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1))
        Text1(10) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2))
        Command5.Enabled = True
    End If
End Sub

Private Sub Text1_Change(Index As Integer)
    If Index = 4 Then
        tSQL = "select * from 成绩单 where 学号='" & Trim(Text1(Index)) & "'and 课程='" & Trim(Text1(Index + 1)) & "'"
        Set Mrc = ExecuteSQL(tSQL, Msgtext)
        If Mrc.EOF = False Then
            Text1(5) = Mrc.Fields(1)
            Text1(6) = Mrc.Fields(2)
            Command3.Enabled = True
            Exit Sub
        Else
            Text1(5) = ""
            Text1(6) = ""
            Command3.Enabled = False
        End If
        Mrc.Close
    End If
    If Index = 8 Then
        tSQL = "select * from 成绩单 where 学号='" & Trim(Text1(Index)) & "'and 课程='" & Trim(Text1(Index + 1)) & "'"
        Set Mrc = ExecuteSQL(tSQL, Msgtext)
        If Mrc.EOF = False Then
            Text1(9) = Mrc.Fields(1)
            Text1(10) = Mrc.Fields(2)
            Command5.Enabled = True
            Exit Sub
        Else
            Text1(9) = ""
            Text1(10) = ""
            Command5.Enabled = False
        End If
        Mrc.Close
    End If
End Sub

Private Sub Text1_GotFocus(Index As Integer)
    Text1(Index).SelStart = 0
    Text1(Index).SelLength = Len(Text1(Index))
End Sub

Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
    EnterToTab KeyCode
End Sub
Private Sub Option1_Click()
    Label1.Visible = True
    Label2.Visible = False
    Text1(12).Visible = True
    Text1(13).Visible = False
End Sub

Private Sub Option2_Click()
    Label2.Visible = True
    Label1.Visible = False
    Text1(13).Visible = True
    Text1(12).Visible = False
End Sub

⌨️ 快捷键说明

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