?? 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 + -