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

📄 form4.frm

📁 要解决三个冲突:1.同一老师任两门以上课程的在同一时间内安排在不同的班讲课 2.不同的课程在相同时间内安排在同一教室 3 .教室容量与学生人数的冲突 数据库:班级表(班级名称,人数) 教师表(教师
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form4 
   BackColor       =   &H8000000A&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "课程设置"
   ClientHeight    =   3120
   ClientLeft      =   6045
   ClientTop       =   330
   ClientWidth     =   5310
   Icon            =   "Form4.frx":0000
   LinkTopic       =   "Form4"
   MaxButton       =   0   'False
   ScaleHeight     =   3120
   ScaleWidth      =   5310
   Begin VB.Frame Frame1 
      BackColor       =   &H8000000A&
      Caption         =   "请在下面填写相关课程  (最多10门)"
      ForeColor       =   &H00000000&
      Height          =   2895
      Left            =   120
      TabIndex        =   6
      Top             =   120
      Width           =   3255
      Begin VB.TextBox Txt 
         Height          =   375
         Index           =   9
         Left            =   1800
         TabIndex        =   0
         Top             =   2160
         Width           =   1095
      End
      Begin VB.TextBox Txt 
         Height          =   375
         Index           =   8
         Left            =   1800
         TabIndex        =   1
         Top             =   1680
         Width           =   1095
      End
      Begin VB.TextBox Txt 
         Height          =   375
         Index           =   7
         Left            =   1800
         TabIndex        =   14
         Top             =   1200
         Width           =   1095
      End
      Begin VB.TextBox Txt 
         Height          =   375
         Index           =   6
         Left            =   1800
         TabIndex        =   13
         Top             =   720
         Width           =   1095
      End
      Begin VB.TextBox Txt 
         Height          =   375
         Index           =   5
         Left            =   1800
         TabIndex        =   12
         Top             =   240
         Width           =   1095
      End
      Begin VB.TextBox Txt 
         Height          =   375
         Index           =   0
         Left            =   240
         TabIndex        =   11
         Top             =   240
         Width           =   1095
      End
      Begin VB.TextBox Txt 
         Height          =   375
         Index           =   1
         Left            =   240
         TabIndex        =   10
         Top             =   720
         Width           =   1095
      End
      Begin VB.TextBox Txt 
         Height          =   375
         Index           =   2
         Left            =   240
         TabIndex        =   9
         Top             =   1200
         Width           =   1095
      End
      Begin VB.TextBox Txt 
         Height          =   375
         Index           =   3
         Left            =   240
         TabIndex        =   8
         Top             =   1680
         Width           =   1095
      End
      Begin VB.TextBox Txt 
         Height          =   375
         Index           =   4
         Left            =   240
         TabIndex        =   7
         Top             =   2160
         Width           =   1095
      End
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H8000000A&
      Height          =   2895
      Left            =   3600
      TabIndex        =   3
      Top             =   120
      Width           =   1575
      Begin VB.CommandButton cn 
         BackColor       =   &H8000000A&
         Caption         =   "取消"
         Height          =   495
         Index           =   2
         Left            =   240
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   2040
         Width           =   1095
      End
      Begin VB.CommandButton cn 
         BackColor       =   &H8000000A&
         Caption         =   "修改"
         Height          =   495
         Index           =   0
         Left            =   240
         Style           =   1  'Graphical
         TabIndex        =   5
         Top             =   360
         Width           =   1095
      End
      Begin VB.CommandButton cn 
         BackColor       =   &H8000000A&
         Caption         =   "保存"
         Height          =   495
         Index           =   1
         Left            =   240
         Style           =   1  'Graphical
         TabIndex        =   4
         Top             =   1200
         Width           =   1095
      End
   End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim str(9) As String

'Dim strSql As String

Private Sub cn_Click(Index As Integer)
'On Error GoTo ex:
Dim lcnt As Integer
Dim strTxt As String

Select Case Index
Case 0:
    CanSave (True)
    
Case 1:
    con.Execute ("delete * from subject")
    
    For lcnt = 0 To 9
        strTxt = Trim$(LTrim$(Txt(lcnt).Text))
        If Len(strTxt) > 0 Then
            rs.AddNew
            rs!csjname = strTxt
            rs.Update
        End If
    Next lcnt
    CanSave (False)
Case 2:
    For lcnt = 0 To 9
        Txt(lcnt) = str(lcnt)
    Next lcnt
    CanSave (False)
    
End Select

        
Exit Sub

ex:
MsgBox "database error", vbOKOnly + vbExclamation, "error"

End Sub

Private Sub Form_Load()
'strSql = "insert into subject values( '"
Set con = New ADODB.Connection
Set rs = New ADODB.Recordset

Call clearTxt
CanSave (False)

con.Open "provider=Microsoft.Jet.OLEDB.4.0; data source= " & App.Path & "\dataUse.mdb"
rs.Open "select * from subject", con, adOpenStatic, adLockOptimistic
Call displayInfo

End Sub
Private Sub CanSave(bSave As Boolean)
Frame1.Enabled = bSave
cn(1).Enabled = bSave
cn(2).Enabled = bSave

cn(0).Enabled = Not bSave

End Sub
Private Sub displayInfo()
rs.MoveFirst
Dim lcnt As Integer
lcnt = 0
While (Not rs.EOF And lcnt < 10)
      
      Txt(lcnt).Text = rs!csjname
      str(lcnt) = Txt(lcnt).Text
      
      lcnt = lcnt + 1
      rs.MoveNext
      
Wend

End Sub
Private Sub clearTxt()
Dim lcnt As Integer
For lcnt = 0 To 9
    Txt(lcnt).Text = ""
Next lcnt

End Sub

Private Sub Form_Unload(Cancel As Integer)
rs.Close
con.Close
Set rs = Nothing
Set con = Nothing

End Sub

⌨️ 快捷键说明

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