📄 frmmodifyclassinfo.frm
字号:
Begin VB.Label Label2
Caption = "年级:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 3720
TabIndex = 6
Top = 600
Width = 732
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "班主任:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 960
TabIndex = 5
Top = 1320
Width = 972
End
Begin VB.Label Label4
Caption = "教室:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 3720
TabIndex = 4
Top = 1320
Width = 732
End
End
Attribute VB_Name = "frmModifyclassinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim tmpcolclass As colclass '现今class集合
Dim updatecolclass As colclass '要进行操作的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
txtClassno.Enabled = False
comboGrade.Enabled = False
txtDirector.Enabled = False
txtClassroom.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 '有记录
tmpcolclass.item(indicator).State = 12 '删除标志
updatecolclass.add tmpcolclass.item(indicator) '添加到操作队列中
If tmpcolclass.remove(indicator) Then
MsgBox "remove ok"
Else
MsgBox "remove error"
End If
End If
If tmpcolclass.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
txtClassno.Enabled = False
comboGrade.Enabled = True
txtDirector.Enabled = False
txtClassroom.Enabled = True
comboGrade.AddItem "小学一年级"
comboGrade.AddItem "小学二年级"
comboGrade.AddItem "小学三年级"
comboGrade.AddItem "小学四年级"
comboGrade.AddItem "小学五年级"
comboGrade.AddItem "小学六年级"
comboGrade.AddItem "初中一年级"
comboGrade.AddItem "初中二年级"
comboGrade.AddItem "初中三年级"
comboGrade.AddItem "高中一年级"
comboGrade.AddItem "高中二年级"
comboGrade.AddItem "高中三年级"
End Sub
Private Sub firstCommand_Click()
If indicator > 1 Then
indicator = 1
Call viewData
End If
End Sub
Private Sub Form_Load()
Dim txtSQL As String
Dim MsgText As String
txtClassno.Enabled = False
comboGrade.Enabled = False
txtDirector.Enabled = False
txtClassroom.Enabled = False
Set tmpcolclass = New colclass
Set updatecolclass = New colclass
tmpcolclass.init
If tmpcolclass.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
txtClassno.Text = tmpcolclass.item(indicator).class_no
comboGrade.Text = tmpcolclass.item(indicator).Grade
txtDirector.Text = tmpcolclass.item(indicator).director
txtClassroom.Text = tmpcolclass.item(indicator).classroom
Else
txtClassno.Text = ""
comboGrade.Text = ""
txtDirector.Text = ""
txtClassroom.Text = ""
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim I As Integer
For I = 1 To updatecolclass.count
If updatecolclass.item(I).State = 11 Then 'update
updatecolclass.item(I).update
End If
If updatecolclass.item(I).State = 12 Then
updatecolclass.item(I).delete
End If
Next
End Sub
Private Sub lastCommand_Click()
If indicator > 0 Then '有记录
indicator = tmpcolclass.count
Call viewData
End If
End Sub
Private Sub nextCommand_Click()
If indicator < tmpcolclass.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(comboGrade.Text) Then
MsgBox "请选择年级!", vbOKOnly + vbExclamation, "警告"
comboGrade.SetFocus
Exit Sub
End If
If Not Testtxt(txtClassroom.Text) Then
MsgBox "请输入教室号码!", vbOKOnly + vbExclamation, "警告"
txtClassroom.SetFocus
Exit Sub
End If
tmpcolclass.item(indicator).State = 11 '更新操作标志
tmpcolclass.item(indicator).classroom = Trim(txtClassroom.Text)
tmpcolclass.item(indicator).Grade = Trim(comboGrade.Text)
updatecolclass.add tmpcolclass.item(indicator) '添加到操作队列中
MsgBox "修改班级信息成功!", vbOKOnly + vbExclamation, "警告"
Call viewData
Frame2.Enabled = True
firstCommand.Enabled = True
previousCommand.Enabled = True
nextCommand.Enabled = True
lastCommand.Enabled = True
txtClassno.Enabled = False
comboGrade.Enabled = False
txtDirector.Enabled = False
txtClassroom.Enabled = False
mcclean = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -