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

📄 frmprpi.frm

📁 自己做的一个学生信息管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmprpi 
   BackColor       =   &H00E0E0E0&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "奖惩信息->设  置"
   ClientHeight    =   5700
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   9765
   Icon            =   "frmprpi.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   5700
   ScaleWidth      =   9765
   Begin VB.TextBox Text2 
      BackColor       =   &H8000000E&
      Height          =   300
      Left            =   2280
      MaxLength       =   10
      TabIndex        =   11
      Top             =   480
      Width           =   1455
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H8000000E&
      Height          =   1140
      Index           =   1
      Left            =   7320
      MaxLength       =   30
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   10
      Top             =   2520
      Width           =   2145
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H8000000E&
      Height          =   300
      Index           =   0
      Left            =   7320
      MaxLength       =   10
      TabIndex        =   9
      Top             =   1680
      Width           =   2145
   End
   Begin CSCommand.Command Command2 
      Height          =   375
      Left            =   8280
      TabIndex        =   8
      Top             =   5040
      Width           =   1095
      _ExtentX        =   1931
      _ExtentY        =   661
      IconAlign       =   0
      Icon            =   "frmprpi.frx":08CA
      Caption         =   "删  除"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin CSCommand.Command Command1 
      Height          =   375
      Left            =   8280
      TabIndex        =   7
      Top             =   4200
      Width           =   1095
      _ExtentX        =   1931
      _ExtentY        =   661
      IconAlign       =   0
      Icon            =   "frmprpi.frx":08E6
      Caption         =   "添  加"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.TextBox Text3 
      BackColor       =   &H8000000E&
      Height          =   300
      Index           =   1
      Left            =   4800
      MaxLength       =   10
      TabIndex        =   5
      Top             =   840
      Width           =   2145
   End
   Begin VB.ListBox List1 
      Appearance      =   0  'Flat
      Height          =   3630
      Left            =   4800
      TabIndex        =   3
      Top             =   1800
      Width           =   2175
   End
   Begin VB.TextBox Text3 
      BackColor       =   &H8000000E&
      Height          =   300
      Index           =   0
      Left            =   4800
      MaxLength       =   14
      TabIndex        =   1
      Top             =   0
      Visible         =   0   'False
      Width           =   1500
   End
   Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
      Height          =   4575
      Left            =   360
      TabIndex        =   0
      Top             =   840
      Width           =   3405
      _ExtentX        =   6006
      _ExtentY        =   8070
      _Version        =   393216
      BackColorFixed  =   14737632
      BackColorBkg    =   -2147483643
      Appearance      =   0
   End
   Begin VB.Label Label6 
      BackColor       =   &H00C0C0C0&
      Caption         =   "X删除X"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   1
      Left            =   3840
      TabIndex        =   15
      Top             =   3120
      Width           =   855
   End
   Begin VB.Label Label6 
      BackColor       =   &H00C0C0C0&
      Caption         =   "<-添加"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   3840
      TabIndex        =   14
      Top             =   2280
      Width           =   855
   End
   Begin VB.Label Label5 
      BackStyle       =   0  'Transparent
      Caption         =   "备注信息"
      Height          =   255
      Left            =   7320
      TabIndex        =   13
      Top             =   2280
      Width           =   1935
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "奖惩名称"
      Height          =   255
      Left            =   7320
      TabIndex        =   12
      Top             =   1440
      Width           =   1935
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "受到奖励或惩罚的时间"
      Height          =   255
      Left            =   4800
      TabIndex        =   6
      Top             =   480
      Width           =   2175
   End
   Begin VB.Label Label2 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "奖 惩 信 息 列 表"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000D&
      Height          =   375
      Left            =   4800
      TabIndex        =   4
      Top             =   1440
      Width           =   2175
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "输入学号进行查询添加"
      Height          =   255
      Left            =   360
      TabIndex        =   2
      Top             =   480
      Width           =   1935
   End
   Begin VB.Label Label7 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   5175
      Index           =   1
      Left            =   4680
      TabIndex        =   17
      Top             =   360
      Width           =   2415
   End
   Begin VB.Label Label7 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H80000008&
      Height          =   5175
      Index           =   0
      Left            =   240
      TabIndex        =   16
      Top             =   360
      Width           =   3615
   End
   Begin VB.Label Label7 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "次块为奖惩信息列表添加和删除内容"
      ForeColor       =   &H00FFFFFF&
      Height          =   5175
      Index           =   2
      Left            =   7200
      TabIndex        =   18
      Top             =   360
      Width           =   2415
   End
End
Attribute VB_Name = "frmprpi"
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

Private Sub Command1_Click()
    Dim txtSQL As String
    If Text1(0) = "" Then
        MsgBox " 奖惩名称不能为空!", vbOKOnly, "提示"
        Text1(0).SetFocus
        Exit Sub
    End If
    txtSQL = "select * from prize_Form where prize_Name='" & Trim(Text1(0)) & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    If mrc.EOF = False Then
        MsgBox "此奖惩名称已经存在!", vbOKOnly, "警告"
        Text1(0).SetFocus
        Exit Sub
    End If
    mrc.Close
    txtSQL = "select * from prize_Form"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    mrc.AddNew
    mrc.Fields(0) = Trim(Text1(0))
    mrc.Fields(1) = Trim(Text1(1))
    mrc.Update
    mrc.Close
    Text1(0) = ""
    Text1(1) = ""
    MsgBox "奖惩信息添加成功!", vbOKOnly, "提示"
    List1Text
End Sub

Private Sub Command2_Click()
    If List1.Text <> "" Then
        txtSQL = "delete from prize_Form where prize_Name='" & Trim(List1.Text) & "'"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        MsgBox "奖惩信息已经删除!", vbOKOnly, "提示"
        List1Text
    End If
End Sub

Private Sub Form_Load()
    MSFlexGrid1.Cols = 5
    MSFlexGrid1.ColWidth(0) = 300
    MSFlexGrid1.ColWidth(1) = 0
    MSFlexGrid1.ColWidth(2) = 0
    MSFlexGrid1.ColWidth(3) = 1200
    MSFlexGrid1.ColWidth(4) = 1200
    MSFlexGrid1.TextMatrix(0, 3) = "奖惩日期"
    MSFlexGrid1.TextMatrix(0, 4) = "奖惩名称"
    MSFlexGrid1.Rows = 1
    Text3(0) = GetRkno
    List1Text
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label6(0).BackColor = &HC0C0C0
    Label6(1).BackColor = &HC0C0C0
End Sub

Private Sub Form_Resize()
    dColor.ZOrder 1
End Sub
Private Sub List1Text()
    Dim txSQL As String
    Dim mrcc As ADODB.Recordset
    txSQL = "select * from prize_Form "
    Set mrcc = ExecuteSQL(txSQL, MsgText)
        List1.Clear
        Do While Not mrcc.EOF
            List1.AddItem Trim(mrcc!prize_Name)
            mrcc.MoveNext
        Loop
    mrcc.Close
End Sub

Private Function GetRkno() As String
    GetRkno = Format(Now, "yymmddhhmmss")
    Randomize
    GetRkno = GetRkno & Int((99 - 10 + 1) * Rnd + 10)
End Function

Private Sub Label6_Click(Index As Integer)
    Dim txtSQL As String
    If Index = 0 Then
        If Text2 = "" Then
            MsgBox " 请输入学号!", vbOKOnly, "提示"
            Text2.SetFocus
            Exit Sub
        Else
            txtSQL = "select * from student_Form where student_NO='" & Trim(Text2) & "'"
            Set mrc = ExecuteSQL(txtSQL, MsgText)
            If mrc.EOF = True Then
                MsgBox "请确认此学号的学籍信息已存在!", vbOKOnly, "警告"
                Text2.SetFocus
                Exit Sub
            End If
            mrc.Close
        End If
        If Text3(1) = "" Then
            MsgBox " 请输入奖惩日期!", vbOKOnly, "提示"
            Text3(1).SetFocus
            Exit Sub
        Else
            If IsDate(Text3(1)) = False Then
                MsgBox "奖惩日期应为日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
                Text3(1).SetFocus
                Exit Sub
            End If
        End If
        If List1.Text = "" Then
            MsgBox " 请选择奖惩名称!", vbOKOnly, "提示"
            List1.SetFocus
            Exit Sub
        End If
        txtSQL = "select * from prize_Stud "
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        mrc.AddNew
        mrc.Fields(0) = Trim(Text3(0))
        mrc.Fields(1) = Trim(Text2)
        mrc.Fields(2) = Trim(Text3(1))
        mrc.Fields(3) = Trim(List1.Text)
        mrc.Update
        mrc.Close
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        txtSQL = "select * from prize_Stud where prize_Stu='" & Trim(Text2) & "'"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        ShowData
        Text3(0) = GetRkno
    End If
    If Index = 1 Then
        If MSFlexGrid1.Row <> 0 Then
            txtSQL = "delete from prize_Stud where prize_No ='" & Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1)) & "'"
            Set mrc = ExecuteSQL(txtSQL, MsgText)
            txtSQL = "select * from prize_Stud where prize_Stu='" & Trim(Text2) & "' "
            Set mrc = ExecuteSQL(txtSQL, MsgText)
            ShowData
        End If
    End If
End Sub

Private Sub Label6_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label6(Index).BackColor = &HFFFFFF
End Sub

Private Sub Label7_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label6(0).BackColor = &HC0C0C0
    Label6(1).BackColor = &HC0C0C0
End Sub

Private Sub Text1_Change(Index As Integer)
    Dim txSQL As String
    If Index = 0 Then
        txtSQL = "select * from prize_Form where prize_Name='" & Trim(Text1(0)) & "'"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        If mrc.EOF = False Then
            Text1(1) = mrc.Fields(1)
            Text1(1).Locked = True
        Else
            Text1(1) = ""
            Text1(1).Locked = False
        End If
    End If
End Sub

Private Sub ShowData()
    With MSFlexGrid1
        .Rows = 1
        Do While Not mrc.EOF
            .Rows = .Rows + 1
            For i = 1 To mrc.Fields.Count
                Select Case mrc.Fields(i - 1).Type
                    Case adDBDate
                        .TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
                    Case Else
                        .TextMatrix(.Rows - 1, i) = mrc.Fields(i - 1) & ""
                End Select
            Next i
            mrc.MoveNext
        Loop
    End With
    mrc.Close
End Sub

Private Sub Text2_Change()
    Dim txtSQL As String
    txtSQL = "select * from prize_Stud where prize_Stu='" & Trim(Text2) & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    ShowData
End Sub

⌨️ 快捷键说明

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