📄 frmmodifycourseinfo.frm
字号:
Top = 360
Width = 1212
End
Begin VB.Label Label2
Caption = "课程名称:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 3480
TabIndex = 6
Top = 360
Width = 1212
End
Begin VB.Label Label3
Caption = "课程类型:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 360
TabIndex = 5
Top = 1200
Width = 1212
End
Begin VB.Label Label4
Caption = "课程描述:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 3480
TabIndex = 4
Top = 1200
Width = 1212
End
End
Attribute VB_Name = "frmModifycourseinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim tmpcolcourse As colcourse '现今class集合
Dim updatecolcourse As colcourse '要进行操作的class集合
Dim mcclean As Boolean '修改标记
Dim indicator As Integer '集合指示器
Private Sub cancelCommand_Click()
If Not mcclean Then
Frame2.Enabled = True
firstCommand.Enabled = True
previousCommand.Enabled = True
nextCommand.Enabled = True
lastCommand.Enabled = True
txtCourseno.Enabled = False
txtCoursename.Enabled = False
comboCoursetype.Enabled = False
txtCoursedes.Enabled = False
Call viewData
Else
MsgBox "什么都没有修改,有什么好取消的!", vbOKOnly + vbExclamation, "警告"
End If
End Sub
Private Sub deleteCommand_Click()
Dim str2 As Integer
str2 = MsgBox("是否删除当前记录?", vbOKCancel, "删除当前记录")
If str2 = vbOK Then
If indicator > 0 Then '有记录
tmpcolcourse.item(indicator).State = 12 '删除标志
updatecolcourse.add tmpcolcourse.item(indicator) '添加到操作队列中
If tmpcolcourse.remove(indicator) Then
MsgBox "remove ok"
Else
MsgBox "remove error"
End If
End If
If tmpcolcourse.count > 0 Then
indicator = 1
Else
indicator = 0
End If
Call viewData
End If
End Sub
Private Sub editCommand_Click()
mcclean = False
Frame2.Enabled = False
firstCommand.Enabled = False
previousCommand.Enabled = False
nextCommand.Enabled = False
lastCommand.Enabled = False
txtCourseno.Enabled = False
txtCoursename.Enabled = True
comboCoursetype.Enabled = True
txtCoursedes.Enabled = True
comboCoursetype.AddItem "必修"
comboCoursetype.AddItem "考查"
End Sub
Private Sub firstCommand_Click()
If indicator > 1 Then
indicator = 1
Call viewData
End If
End Sub
Private Sub Form_Load()
txtCourseno.Enabled = False
txtCoursename.Enabled = False
comboCoursetype.Enabled = False
txtCoursedes.Enabled = False
Set tmpcolcourse = New colcourse
Set updatecolcourse = New colcourse
tmpcolcourse.init
If tmpcolcourse.count < 1 Then
indicator = 0
Frame2.Enabled = False
Frame3.Enabled = False
Else
indicator = 1
End If
Call viewData
mcclean = True
End Sub
Public Sub viewData()
If indicator > 0 Then
txtCourseno.Text = tmpcolcourse.item(indicator).course_no
txtCoursename.Text = tmpcolcourse.item(indicator).course_name
comboCoursetype.Text = tmpcolcourse.item(indicator).course_type
txtCoursedes.Text = tmpcolcourse.item(indicator).course_des
Else
txtCourseno.Text = ""
txtCoursename.Text = ""
comboCoursetype.Text = ""
txtCoursedes.Text = ""
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim I As Integer
For I = 1 To updatecolcourse.count
If updatecolcourse.item(I).State = 11 Then 'update
updatecolcourse.item(I).update
End If
If updatecolcourse.item(I).State = 12 Then
updatecolcourse.item(I).delete
End If
Next
End Sub
Private Sub lastCommand_Click()
If indicator > 0 Then '有记录
indicator = tmpcolcourse.count
Call viewData
End If
End Sub
Private Sub nextCommand_Click()
If indicator < tmpcolcourse.count And indicator > 0 Then
indicator = indicator + 1
Call viewData
End If
End Sub
Private Sub previousCommand_Click()
If indicator > 1 Then
indicator = indicator - 1
Call viewData
End If
End Sub
Private Sub updateCommand_Click()
If Not Testtxt(txtCoursename.Text) Then
MsgBox "请输入课程名称!", vbOKOnly + vbExclamation, "警告"
txtCoursename.SetFocus
Exit Sub
End If
If Not Testtxt(comboCoursetype.Text) Then
MsgBox "请选择课程类型!", vbOKOnly + vbExclamation, "警告"
comboCoursetype.SetFocus
Exit Sub
End If
If Not Testtxt(txtCoursedes.Text) Then
MsgBox "请输入课程描述信息!", vbOKOnly + vbExclamation, "警告"
txtCoursedes.SetFocus
Exit Sub
End If
tmpcolcourse.item(indicator).State = 11 '更新操作标志
tmpcolcourse.item(indicator).course_name = Trim(txtCoursename.Text)
tmpcolcourse.item(indicator).course_type = Trim(comboCoursetype.Text)
tmpcolcourse.item(indicator).course_des = Trim(txtCoursedes.Text)
updatecolcourse.add tmpcolcourse.item(indicator) '添加到操作队列中
MsgBox "修改班级信息成功!", vbOKOnly + vbExclamation, "警告"
Call viewData
Frame2.Enabled = True
firstCommand.Enabled = True
previousCommand.Enabled = True
nextCommand.Enabled = True
lastCommand.Enabled = True
txtCourseno.Enabled = False
txtCoursename.Enabled = False
comboCoursetype.Enabled = False
txtCoursedes.Enabled = False
mcclean = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -