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

📄 frmsetcourseinfo.frm

📁 vb作的学生信息管理系统!非常好用,sdg dfh fgh f
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmSetcourseinfo 
   Caption         =   "设置年级课程信息"
   ClientHeight    =   4800
   ClientLeft      =   48
   ClientTop       =   348
   ClientWidth     =   7020
   LinkTopic       =   "Form1"
   ScaleHeight     =   4800
   ScaleWidth      =   7020
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdSet 
      Caption         =   "设置课程"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   960
      TabIndex        =   10
      Top             =   3960
      Width           =   1572
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退出课程设置"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   4560
      TabIndex        =   9
      Top             =   3960
      Width           =   1572
   End
   Begin VB.CommandButton cmdModify 
      Caption         =   "确认设置"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   2760
      TabIndex        =   8
      Top             =   3960
      Width           =   1572
   End
   Begin VB.CommandButton cmdDelete 
      Caption         =   "<--"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   2760
      TabIndex        =   5
      Top             =   2760
      Width           =   852
   End
   Begin VB.ListBox listSelectcourse 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1776
      ItemData        =   "frmSetcourseinfo.frx":0000
      Left            =   4200
      List            =   "frmSetcourseinfo.frx":0002
      TabIndex        =   4
      Top             =   1680
      Width           =   1452
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "-->"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   2760
      TabIndex        =   3
      Top             =   2040
      Width           =   852
   End
   Begin VB.ListBox listAllcourse 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1776
      ItemData        =   "frmSetcourseinfo.frx":0004
      Left            =   840
      List            =   "frmSetcourseinfo.frx":0006
      TabIndex        =   2
      Top             =   1680
      Width           =   1332
   End
   Begin VB.ComboBox comboGrade 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   312
      Left            =   2880
      TabIndex        =   1
      Top             =   480
      Width           =   1692
   End
   Begin VB.Label Label3 
      Caption         =   "已经选择课程:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   4200
      TabIndex        =   7
      Top             =   1320
      Width           =   1692
   End
   Begin VB.Label Label2 
      Caption         =   "所有课程:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   1080
      TabIndex        =   6
      Top             =   1320
      Width           =   1212
   End
   Begin VB.Label Label1 
      Caption         =   "选择年级:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.8
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   1320
      TabIndex        =   0
      Top             =   480
      Width           =   1212
   End
End
Attribute VB_Name = "frmSetcourseinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim flagSet As Boolean
Dim flagGrade As Boolean

Private Sub cmdAdd_Click()
    If listAllcourse.ListIndex <> -1 Then
        listSelectcourse.AddItem listAllcourse.List(listAllcourse.ListIndex)
        
    End If
        
    
End Sub

Private Sub cmdDelete_Click()
    If listSelectcourse.ListIndex <> -1 Then
        listSelectcourse.RemoveItem listSelectcourse.ListIndex
    End If
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub cmdModify_Click()
    Dim i As Integer
    Dim mrc As ADODB.Recordset
    Dim mrcc As ADODB.Recordset
    Dim txtSQL As String
    Dim MsgText As String
    Dim myBookmark As Variant
    
    If Not Testtxt(comboGrade.Text) Then
        MsgBox "请先选择年级!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    End If
    
    If Not Testtxt(listSelectcourse.List(0)) Then
        MsgBox "请选择课程!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    End If
    
    txtSQL = "select * from gradecourse_Info where grade = '" & Trim(comboGrade.Text) & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    If mrc.EOF Then
        For i = 1 To listSelectcourse.ListCount
            mrc.AddNew
            mrc.Fields(0) = comboGrade.Text
            mrc.Fields(1) = listSelectcourse.List(i - 1)
            mrc.Update
        Next i
        mrc.Close
        MsgBox "课程设置成功!", vbOKOnly + vbExclamation, "警告"
        
    Else
        mrc.Close
        txtSQL = "delete  from gradecourse_Info where grade = '" & Trim(comboGrade.Text) & "'"
        Set mrcc = ExecuteSQL(txtSQL, MsgText)
        
        
        txtSQL = "select * from gradecourse_Info "
        Set mrcc = ExecuteSQL(txtSQL, MsgText)
        For i = 1 To listSelectcourse.ListCount
            mrcc.AddNew
            mrcc.Fields(0) = comboGrade.Text
            mrcc.Fields(1) = listSelectcourse.List(i - 1)
            mrcc.Update
        Next i
        mrcc.Close
        MsgBox "课程设置成功!", vbOKOnly + vbExclamation, "警告"
    End If
        
        
    
    
End Sub

Private Sub cmdSet_Click()
    Dim mrc As ADODB.Recordset
    Dim txtSQL As String
    Dim MsgText As String
    
    listAllcourse.Enabled = True
    listSelectcourse.Enabled = True
    cmdModify.Enabled = True
    
    txtSQL = "select * from course_Info "
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    While (mrc.EOF = False)
        listAllcourse.AddItem mrc.Fields(1)
        mrc.MoveNext
    Wend
    mrc.Close
    flagSet = True
End Sub

Private Sub comboGrade_Click()
    Dim mrc As ADODB.Recordset
    Dim txtSQL As String
    Dim MsgText As String
    Dim i As Integer
    
    
    listSelectcourse.Clear
    txtSQL = "select * from gradecourse_Info where grade = '" & comboGrade.Text & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    If Not mrc.EOF Then
        For i = 1 To mrc.RecordCount
            listSelectcourse.AddItem mrc.Fields(1)
            mrc.MoveNext
        Next i
    End If
    mrc.Close
End Sub

Private Sub Form_Load()
    flagSet = False
    flagGrade = False
    listAllcourse.Enabled = False
    listSelectcourse.Enabled = False
    cmdModify.Enabled = False
    comboGrade.AddItem "初中一年级"
    comboGrade.AddItem "初中二年级"
    comboGrade.AddItem "初中三年级"
    comboGrade.AddItem "高中一年级"
    comboGrade.AddItem "高中二年级"
    comboGrade.AddItem "高中三年级"
End Sub



Private Sub listAllcourse_Click()
    If listAllcourse.ListIndex <> -1 Then
        listSelectcourse.ListIndex = -1
    End If
End Sub

Private Sub listSelectcourse_Click()
    If listSelectcourse.ListIndex <> -1 Then
        listAllcourse.ListIndex = -1
    End If
End Sub

⌨️ 快捷键说明

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