www.pudn.com > student.zip > frmModifyclassinfo.frm
VERSION 5.00
Begin VB.Form frmModifyclassinfo
Caption = "修改班级信息"
ClientHeight = 4830
ClientLeft = 45
ClientTop = 345
ClientWidth = 7965
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 4830
ScaleWidth = 7965
Begin VB.Frame Frame2
Caption = "查看班级信息"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1092
Left = 360
TabIndex = 13
Top = 2160
Width = 6972
Begin VB.CommandButton lastCommand
Caption = "最后一条记录"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 4920
TabIndex = 17
Top = 360
Width = 1692
End
Begin VB.CommandButton nextCommand
Caption = "下一条记录"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 3360
TabIndex = 16
Top = 360
Width = 1452
End
Begin VB.CommandButton previousCommand
Caption = "上一条记录"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 1800
TabIndex = 15
Top = 360
Width = 1452
End
Begin VB.CommandButton firstCommand
Caption = "第一条记录"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 240
TabIndex = 14
Top = 360
Width = 1452
End
End
Begin VB.Frame Frame3
Caption = "修改班级信息"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1092
Left = 360
TabIndex = 8
Top = 3360
Width = 6972
Begin VB.CommandButton deleteCommand
Caption = "删除记录"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 5160
TabIndex = 12
Top = 360
Width = 1452
End
Begin VB.CommandButton cancelCommand
Caption = "取消修改记录"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 3360
TabIndex = 11
Top = 360
Width = 1692
End
Begin VB.CommandButton updateCommand
Caption = "更新数据"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 1800
TabIndex = 10
Top = 360
Width = 1452
End
Begin VB.CommandButton editCommand
Caption = "修改记录"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 240
TabIndex = 9
Top = 360
Width = 1452
End
End
Begin VB.TextBox txtClassno
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 2040
TabIndex = 3
Top = 600
Width = 1332
End
Begin VB.TextBox txtDirector
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 2040
TabIndex = 2
Top = 1320
Width = 1332
End
Begin VB.TextBox txtClassroom
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 4560
TabIndex = 1
Top = 1320
Width = 1692
End
Begin VB.ComboBox comboGrade
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 4560
TabIndex = 0
Top = 600
Width = 1692
End
Begin VB.Label Label1
Caption = "班号:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 1080
TabIndex = 7
Top = 600
Width = 732
End
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