📄 frmarrangeedit.frm
字号:
VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmArrangeEdit
BorderStyle = 1 'Fixed Single
Caption = "编辑课程安排"
ClientHeight = 3465
ClientLeft = 45
ClientTop = 330
ClientWidth = 6165
Icon = "FrmArrangeEdit.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3465
ScaleWidth = 6165
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Default = -1 'True
Height = 400
Left = 1020
MouseIcon = "FrmArrangeEdit.frx":0CCA
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 7
Top = 3000
Width = 1300
End
Begin VB.CommandButton Cmd_Cancel
Cancel = -1 'True
Caption = "取 消"
Height = 400
Left = 3600
MouseIcon = "FrmArrangeEdit.frx":0FD4
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 6
Top = 3000
Width = 1300
End
Begin VB.Frame Frame1
Height = 2655
Left = 120
TabIndex = 0
Top = 120
Width = 5895
Begin MSDataListLib.DataCombo DataCombo1
Bindings = "FrmArrangeEdit.frx":12DE
Height = 330
Left = 1200
TabIndex = 10
Top = 1245
Width = 3375
_ExtentX = 5953
_ExtentY = 582
_Version = 393216
Style = 2
Text = "DataCombo1"
End
Begin VB.TextBox txtHours
Height = 300
Left = 1200
MaxLength = 100
TabIndex = 2
Top = 2220
Width = 975
End
Begin VB.TextBox txtTeacher
Height = 300
Left = 1200
MaxLength = 50
TabIndex = 1
Top = 1740
Width = 3375
End
Begin MSAdodcLib.Adodc AdoLesson
Height = 330
Left = 1800
Top = 0
Visible = 0 'False
Width = 2415
_ExtentX = 4260
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "AdoLesson"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "班级名称"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 12
Top = 840
Width = 720
End
Begin VB.Label lblClass
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "班级名称"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 1200
TabIndex = 11
Top = 840
Width = 720
End
Begin VB.Label lblTerm
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "学期名称"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 1200
TabIndex = 9
Top = 360
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "学期名称"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 8
Top = 360
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "课时设置"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 5
Top = 2280
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "教师工号"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 4
Top = 1800
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "课程名称"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 3
Top = 1320
Width = 720
End
End
End
Attribute VB_Name = "FrmArrangeEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public OriId As Long
Public TermId As Long
Public ClassId As Long
Public LessonId As Long
Public modify As Boolean
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
'判断是否输入了课程名称
If Val(DataCombo1.BoundText) <= 0 Then
MsgBox "请选择课程名称"
DataCombo1.SetFocus
Exit Sub
End If
If Len(Trim(txtTeacher.Text)) = 0 Then
MsgBox "请输入教师证件号码!", vbExclamation
txtTeacher.SetFocus
Exit Sub
End If
'判断是否有该教师存在
If MyTeacher.Teacher_In_DB(MakeStr(txtTeacher.Text)) = False Then
MsgBox "没有该教师信息!", vbExclamation
txtTeacher.SetFocus
Exit Sub
End If
'把用户录入的数据赋值到MyLesson对象的成员变量中
With MyArrange
.TermId = TermId
.LessonId = Val(DataCombo1.BoundText)
.Class_Id = ClassId
'.LessonType = Trim(ComboType.Text)
.Teacher_Id = MakeStr(txtTeacher)
.Hours = Val(txtHours)
.Vote = 0
'根据变量Modify决定是插入新数据,还是更新已有的数据
If modify = False Then
'是否已经存在该纪录
If MyArrange.GetId(TermId, ClassId, Val(DataCombo1.BoundText)) = 0 Then
'添加
.Insert
Else
MsgBox "该纪录已经存在!", vbExclamation
Exit Sub
End If
Else
'更新
Call .Update(OriId)
End If
End With
MsgBox "编辑完成"
'关闭窗口
Unload Me
End Sub
Private Sub Form_Load()
'设置记录源
AdoLesson.ConnectionString = conn
AdoLesson.RecordSource = "SELECT * FROM Lessons ORDER BY LessonName"
AdoLesson.Refresh
DataCombo1.ListField = "LessonName"
DataCombo1.BoundColumn = "LessonId"
DataCombo1.BoundText = LessonId
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -