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

📄 form3.frm

📁 Visual Basic管理信息系统开发 排课管理系统(源代码)
💻 FRM
📖 第 1 页 / 共 3 页
字号:
         Index           =   8
         Left            =   120
         TabIndex        =   14
         Top             =   4080
         Width           =   6495
         Begin VB.ComboBox Combo3 
            Height          =   315
            Index           =   40
            Left            =   600
            TabIndex        =   19
            Text            =   "Combo3"
            Top             =   0
            Width           =   1095
         End
         Begin VB.ComboBox Combo3 
            Height          =   315
            Index           =   41
            Left            =   1800
            TabIndex        =   18
            Text            =   "Combo3"
            Top             =   0
            Width           =   1095
         End
         Begin VB.ComboBox Combo3 
            Height          =   315
            Index           =   42
            Left            =   3000
            TabIndex        =   17
            Text            =   "Combo3"
            Top             =   0
            Width           =   1095
         End
         Begin VB.ComboBox Combo3 
            Height          =   315
            Index           =   43
            Left            =   4200
            TabIndex        =   16
            Text            =   "Combo3"
            Top             =   0
            Width           =   1095
         End
         Begin VB.ComboBox Combo3 
            Height          =   315
            Index           =   44
            Left            =   5400
            TabIndex        =   15
            Text            =   "Combo3"
            Top             =   0
            Width           =   1095
         End
         Begin VB.Label Label3 
            Alignment       =   2  'Center
            BackStyle       =   0  'Transparent
            Caption         =   "n"
            ForeColor       =   &H00000000&
            Height          =   255
            Index           =   8
            Left            =   120
            TabIndex        =   20
            Top             =   0
            Width           =   375
         End
      End
      Begin VB.Frame Frame4 
         BackColor       =   &H8000000A&
         BorderStyle     =   0  'None
         Height          =   330
         Index           =   9
         Left            =   120
         TabIndex        =   7
         Top             =   4440
         Width           =   6495
         Begin VB.ComboBox Combo3 
            Height          =   315
            Index           =   45
            Left            =   600
            TabIndex        =   12
            Text            =   "Combo3"
            Top             =   0
            Width           =   1095
         End
         Begin VB.ComboBox Combo3 
            Height          =   315
            Index           =   46
            Left            =   1800
            TabIndex        =   11
            Text            =   "Combo3"
            Top             =   0
            Width           =   1095
         End
         Begin VB.ComboBox Combo3 
            Height          =   315
            Index           =   47
            Left            =   3000
            TabIndex        =   10
            Text            =   "Combo3"
            Top             =   0
            Width           =   1095
         End
         Begin VB.ComboBox Combo3 
            Height          =   315
            Index           =   48
            Left            =   4200
            TabIndex        =   9
            Text            =   "Combo3"
            Top             =   0
            Width           =   1095
         End
         Begin VB.ComboBox Combo3 
            Height          =   315
            Index           =   49
            Left            =   5400
            TabIndex        =   8
            Text            =   "Combo3"
            Top             =   0
            Width           =   1095
         End
         Begin VB.Label Label3 
            Alignment       =   2  'Center
            BackStyle       =   0  'Transparent
            Caption         =   "n"
            ForeColor       =   &H00000000&
            Height          =   255
            Index           =   9
            Left            =   120
            TabIndex        =   13
            Top             =   0
            Width           =   375
         End
      End
      Begin VB.Line Line2 
         BorderWidth     =   5
         Index           =   0
         X1              =   120
         X2              =   6600
         Y1              =   2280
         Y2              =   2280
      End
      Begin VB.Line Line2 
         BorderWidth     =   6
         Index           =   1
         X1              =   120
         X2              =   6600
         Y1              =   3840
         Y2              =   3840
      End
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H8000000A&
      Caption         =   "输入数据"
      ForeColor       =   &H00000000&
      Height          =   2055
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   6735
      Begin VB.OptionButton Opn 
         BackColor       =   &H8000000A&
         Caption         =   "任课科目"
         ForeColor       =   &H00000000&
         Height          =   375
         Index           =   1
         Left            =   1800
         TabIndex        =   4
         Top             =   1080
         Width           =   1095
      End
      Begin VB.OptionButton Opn 
         BackColor       =   &H8000000A&
         Caption         =   "任课班级"
         ForeColor       =   &H00000000&
         Height          =   375
         Index           =   0
         Left            =   360
         TabIndex        =   5
         Top             =   1080
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H8000000A&
         Caption         =   "查询"
         Height          =   375
         Left            =   3120
         Style           =   1  'Graphical
         TabIndex        =   3
         Top             =   360
         Width           =   1095
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   1560
         TabIndex        =   2
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "教职员姓名:"
         ForeColor       =   &H00000000&
         Height          =   255
         Left            =   240
         TabIndex        =   1
         Top             =   480
         Width           =   1095
      End
   End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'定义数据链接
Dim conn As ADODB.Connection
'定义临时数据集
Dim rs As ADODB.Recordset
'定义教师数据集
Dim rsTr As ADODB.Recordset
'存储SQL语句的临时变量
Dim i, j, value, idx As Integer
Dim strName, strSql As String

'定义数据结构DataGet
Private Type DataGet
class As String
Sjname As String

Tw As Integer
Tn As Integer
End Type

Private Sub Command1_Click()
On Error GoTo bnEnd
Me.MousePointer = 11

Dim sSql As String
Dim dgUse As DataGet
    Call ClearCombo
    strName = LTrim$(RTrim$(Combo1.Text))
    If Len(strName) > 0 Then
        sSql = strSql & "'" & strName & "'"
        
        Set rs = conn.Execute(sSql)
        If Not rs.EOF Then
            While Not rs.EOF
                dgUse.class = rs.Fields(0)
                dgUse.Sjname = rs.Fields(1)
                dgUse.Tw = rs.Fields(2)
                dgUse.Tn = rs.Fields(3)
                idx = (dgUse.Tn - 1) * 5 + dgUse.Tw - 1
                Combo3(idx).Visible = True
                Combo3(idx).AddItem (dgUse.class & "班")
                Combo3(idx).AddItem (dgUse.Sjname)
                Combo3(idx).Text = Combo3(idx).List(value)
                rs.MoveNext
              Wend
        Else
            MsgBox "没有得到相关数据,请检查", vbOKOnly + vbInformation, "数据捕捉"
        End If
        Dim lcnt As Integer
        For lcnt = 0 To 49
            If Combo3(lcnt).ListCount > 2 Then
                Combo3(lcnt).BackColor = RGB(200, 255, 255)
                Combo3(lcnt).AddItem ("注意有重课")
                
            End If
        Next lcnt
    Else
        MsgBox "请输入或选择一教职员姓名", vbInformation + vbOKOnly, "查询输入"
    End If
   
bnEnd:
Me.MousePointer = 0
            
End Sub
Private Sub ClearCombo()
For i = 0 To 49
    Combo3(i).BackColor = RGB(255, 255, 255)
    
    Combo3(i).Text = ""
    Combo3(i).Visible = False
    Combo3(i).Clear
    
Next i
End Sub
Private Sub Form_Load()
Me.MousePointer = 11

On Error GoTo KKa
Set conn = New ADODB.Connection

conn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source= " & App.Path & "\dataUse.mdb"
Set rsTr = conn.Execute("select ctrname from teacher")
For i = 0 To 9
    Label3(i).Caption = i + 1
Next i

While Not rsTr.EOF
    Combo1.AddItem (rsTr.Fields(0))
    rsTr.MoveNext
    
Wend
Call ClearCombo
strSql = "select trclass.cclasscode,trclass.csubject,classarray.itimew,classarray.itimen" + _
" from teacher,trclass,classarray " + _
"where teacher.ctrname=trclass.cteacher and trclass.cclasscode=classarray.cclasscode" + _
" and trclass.csubject=classarray.csjname and teacher.ctrname="

value = 0
GoTo ok
KKa:
MsgBox "Error Unknown"
ok:
Me.MousePointer = 0

End Sub

Private Sub Form_Unload(Cancel As Integer)

On Error GoTo KK:
rs.Close
rsTr.Close
Set rs = Nothing
Set rsTr = Nothing
conn.Close
Set conn = Nothing
KK:

End Sub

Private Sub Opn_Click(Index As Integer)
'设定选项
value = Index
Call Command1_Click

End Sub

⌨️ 快捷键说明

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