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

📄 setcourse.frm

📁 这是一个我帮师妹做的软件的大作业
💻 FRM
字号:
VERSION 5.00
Begin VB.Form setCourse 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "设置总评课程"
   ClientHeight    =   4770
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   5640
   Icon            =   "setCourse.frx":0000
   LinkTopic       =   "Form3"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4770
   ScaleWidth      =   5640
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame1 
      Height          =   4695
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   5415
      Begin VB.Frame Frame4 
         Caption         =   "学期:"
         Height          =   615
         Left            =   0
         TabIndex        =   10
         Top             =   0
         Width           =   5415
         Begin VB.ComboBox Combo1 
            BackColor       =   &H80000018&
            Height          =   300
            Index           =   3
            ItemData        =   "setCourse.frx":08CA
            Left            =   120
            List            =   "setCourse.frx":08E3
            Style           =   2  'Dropdown List
            TabIndex        =   11
            Top             =   195
            Width           =   2655
         End
      End
      Begin VB.Frame Frame5 
         Caption         =   "所有课程"
         Height          =   3375
         Left            =   0
         TabIndex        =   7
         Top             =   720
         Width           =   2175
         Begin VB.ListBox List1 
            BackColor       =   &H80000018&
            Height          =   3000
            ItemData        =   "setCourse.frx":093B
            Left            =   120
            List            =   "setCourse.frx":093D
            Style           =   1  'Checkbox
            TabIndex        =   8
            Top             =   240
            Width           =   1935
         End
      End
      Begin VB.Frame Frame6 
         Caption         =   "所选总评课程"
         Height          =   3375
         Left            =   3240
         TabIndex        =   5
         Top             =   720
         Width           =   2175
         Begin VB.ListBox List2 
            BackColor       =   &H80000018&
            Height          =   3000
            ItemData        =   "setCourse.frx":093F
            Left            =   120
            List            =   "setCourse.frx":0941
            Style           =   1  'Checkbox
            TabIndex        =   6
            Top             =   240
            Width           =   1935
         End
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   375
         Left            =   720
         TabIndex        =   4
         Top             =   4200
         Width           =   1095
      End
      Begin VB.CommandButton Command2 
         Caption         =   "取消"
         Height          =   375
         Left            =   3840
         TabIndex        =   3
         Top             =   4200
         Width           =   1095
      End
      Begin VB.CommandButton Command3 
         Caption         =   "==>>"
         Height          =   375
         Left            =   2400
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   2160
         Width           =   615
      End
      Begin VB.CommandButton Command4 
         Caption         =   "<<=="
         Height          =   375
         Left            =   2400
         Style           =   1  'Graphical
         TabIndex        =   1
         Top             =   2760
         Width           =   615
      End
      Begin VB.Label Label1 
         Caption         =   "从左面选择本学期的总评课程,添加到右面的方框中!"
         Height          =   1215
         Left            =   2280
         TabIndex        =   9
         Top             =   960
         Width           =   855
      End
   End
End
Attribute VB_Name = "setCourse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Not Testtxt(Combo1(3).Text) Then
MsgBox "必须选择学期!", vbOKOnly + vbExclamation, "警告"
Combo1(3).SetFocus
Exit Sub
End If
If List2.ListCount = 0 Then
   ssss = MsgBox("你还没有选择课程!", vbInformation + vbOKOnly, "警告")
   Exit Sub
End If
Dim mrc As ADODB.Recordset
txtSQL = "select * from zpcourse where 学期='" & Trim(Combo1(3).Text) & "'"
Set mrc = ExecuteSQL(txtSQL)
If mrc.EOF = False Then
   sss = MsgBox("已存在该班级本学期课程设置和成绩记录," & Chr(10) & Chr(13) & "继续会导致以上的成绩丢失,继续吗?!", vbOKCancel + vbExclamation, "警告")
 If sss = vbCancel Then
   Exit Sub
 Else
   txtSQL = "delete * from zpcourse where 学期='" & Trim(Combo1(3).Text) & "'"
  Set mrc = ExecuteSQL(txtSQL)
End If
End If
txtSQL = "select * from zpcourse"
Set mrc = ExecuteSQL(txtSQL)
For i = o To List2.ListCount - 1
 mrc.AddNew
 mrc.Fields(1) = Trim(Combo1(3).Text)
 mrc.Fields(2) = Trim(List2.List(i))
 mrc.Update
Next i
ssss = MsgBox("课程设置成功!", vbInformation + vbOKOnly, "提示")
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
Dim i As Integer
i = 0
Do While i < List1.ListCount
  If List1.Selected(i) = True Then
    List2.AddItem List1.List(i)
    List1.RemoveItem i
  Else
   i = i + 1
  End If
Loop
If List1.ListCount = 0 Then
Command3.Enabled = False
End If
If List2.ListCount <> 0 Then
Command4.Enabled = True
End If
End Sub

Private Sub Command4_Click()
Dim i As Integer
i = 0
Do While i < List2.ListCount
  If List2.Selected(i) = True Then
    List1.AddItem List2.List(i)
    List2.RemoveItem i
  Else
   i = i + 1
  End If
Loop
If List1.ListCount <> 0 Then
Command3.Enabled = True
End If
If List2.ListCount = 0 Then
Command4.Enabled = False
End If
End Sub

Private Sub Form_Load()
Dim mrc As ADODB.Recordset
List1.Clear
List2.Clear
txtSQL = "select 课程名称 from course"
Set mrc = ExecuteSQL(txtSQL)
If mrc.EOF = True Then
Exit Sub
End If
 mrc.MoveFirst
Do Until mrc.EOF
   List1.AddItem mrc.Fields(0)
 mrc.MoveNext
Loop
Set mrc = Nothing
'判断按纽是否有效
If List1.ListCount = 0 Then
  Command3.Enabled = False
Else
 Command3.Enabled = True
End If
If List2.ListCount = 0 Then
  Command4.Enabled = False
Else
 Command4.Enabled = True
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
frmMain.Enabled = True
End Sub

⌨️ 快捷键说明

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