frmModifyclassinfo.frm
上传用户:rocksue
上传日期:2013-06-17
资源大小:41926k
文件大小:16k
- VERSION 5.00
- Begin VB.Form frmModifyclassinfo
- Caption = "修改班级信息"
- ClientHeight = 4824
- ClientLeft = 48
- ClientTop = 348
- ClientWidth = 7956
- LinkTopic = "Form1"
- ScaleHeight = 4824
- ScaleWidth = 7956
- StartUpPosition = 3 'Windows Default
- 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.8
- 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.8
- 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.8
- 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.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 312
- Left = 4560
- TabIndex = 0
- Top = 600
- Width = 1692
- End
- Begin VB.Label Label1
- Caption = "班号:"
- BeginProperty Font
- Name = "宋体"
- Size = 10.8
- 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.8
- 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.8
- 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.8
- 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
- Dim mrc As ADODB.Recordset
- Dim myBookmark As Variant
- Dim mcclean As Boolean
- 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
-
- mrc.Bookmark = myBookmark
- Call viewData
- Else
- MsgBox "什么都没有修改,有什么好取消的!", vbOKOnly + vbExclamation, "警告"
- End If
- End Sub
- Private Sub deleteCommand_Click()
- myBookmark = mrc.Bookmark
- str2$ = MsgBox("是否删除当前记录?", vbOKCancel, "删除当前记录")
- If str2$ = vbOK Then
- mrc.MoveNext
- If mrc.EOF Then
- mrc.MoveFirst
- myBookmark = mrc.Bookmark
- mrc.MoveLast
- mrc.Delete
- mrc.Bookmark = myBookmark
- Call viewData
- Else
- myBookmark = mrc.Bookmark
- mrc.MovePrevious
- mrc.Delete
- mrc.Bookmark = myBookmark
- Call viewData
- End If
- Else
- mrc.Bookmark = myBookmark
- 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 = True
- comboGrade.Enabled = True
- txtDirector.Enabled = True
- txtClassroom.Enabled = True
-
- comboGrade.AddItem "初中一年级"
- comboGrade.AddItem "初中二年级"
- comboGrade.AddItem "初中三年级"
- comboGrade.AddItem "高中一年级"
- comboGrade.AddItem "高中二年级"
- comboGrade.AddItem "高中三年级"
-
- myBookmark = mrc.Bookmark
- End Sub
- Private Sub firstCommand_Click()
- mrc.MoveFirst
- Call viewData
- 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
-
- txtSQL = "select * from class_Info "
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- mrc.MoveFirst
- Call viewData
- myBookmark = mrc.Bookmark
- mcclean = True
-
-
- End Sub
- Public Sub viewData()
- txtClassno.Text = mrc.Fields(0)
- comboGrade.Text = mrc.Fields(1)
- txtDirector.Text = mrc.Fields(2)
- txtClassroom.Text = mrc.Fields(3)
-
- End Sub
- Private Sub lastCommand_Click()
- mrc.MoveLast
- Call viewData
- End Sub
- Private Sub nextCommand_Click()
- mrc.MoveNext
- If mrc.EOF Then
- mrc.MoveFirst
- End If
- Call viewData
- End Sub
- Private Sub previousCommand_Click()
- mrc.MovePrevious
- If mrc.BOF Then
- mrc.MoveLast
- End If
- Call viewData
- End Sub
- Private Sub updateCommand_Click()
- Dim txtSQL As String
- Dim MsgText As String
- Dim mrcc As ADODB.Recordset
-
- If mcclean Then
- MsgBox "请先修改班级信息", vbOKOnly + vbExclamation, "警告"
- Exit Sub
- End If
-
- If Not Testtxt(txtClassno.Text) Then
- MsgBox "请输入班号!", vbOKOnly + vbExclamation, "警告"
- txtClassno.SetFocus
- Exit Sub
- End If
-
- If Not IsNumeric(Trim(txtClassno.Text)) Then
- MsgBox "请输入数字!", vbOKOnly + vbExclamation, "警告"
- Exit Sub
- txtClassno.SetFocus
- End If
-
-
- If Not Testtxt(comboGrade.Text) Then
- MsgBox "请选择年级!", vbOKOnly + vbExclamation, "警告"
- comboGrade.SetFocus
-
- Exit Sub
- End If
-
- If Not Testtxt(txtDirector.Text) Then
- MsgBox "请输入班主任姓名!", vbOKOnly + vbExclamation, "警告"
- txtDirector.SetFocus
- Exit Sub
- End If
-
-
- If Not Testtxt(txtClassroom.Text) Then
- MsgBox "请输入教室号码!", vbOKOnly + vbExclamation, "警告"
- txtClassroom.SetFocus
- Exit Sub
- End If
-
- mrc.Delete
- txtSQL = "select * from class_Info where class_No = '" & Trim(txtClassno.Text) & "'"
- Set mrcc = ExecuteSQL(txtSQL, MsgText)
- If mrcc.EOF = False Then
- MsgBox "班号重复,请重新输入!", vbOKOnly + vbExclamation, "警告"
- mrcc.Close
- txtClassno.SetFocus
- Else
- mrcc.Close
- mrc.AddNew
- mrc.Fields(0) = Trim(txtClassno.Text)
- mrc.Fields(1) = Trim(comboGrade.Text)
- mrc.Fields(2) = Trim(txtDirector.Text)
- mrc.Fields(3) = Trim(txtClassroom.Text)
- mrc.Update
- MsgBox "修改班级信息成功!", vbOKOnly + vbExclamation, "警告"
- mrc.Bookmark = myBookmark
- 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 If
- End Sub