frmAddclassinfo.frm
上传用户:rocksue
上传日期:2013-06-17
资源大小:41926k
文件大小:8k
- VERSION 5.00
- Begin VB.Form frmAddclassinfo
- Caption = "添加班级信息"
- ClientHeight = 2604
- ClientLeft = 48
- ClientTop = 348
- ClientWidth = 5808
- LinkTopic = "Form1"
- MDIChild = -1 'True
- ScaleHeight = 2604
- ScaleWidth = 5808
- 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 = 3720
- TabIndex = 9
- Top = 480
- Width = 1692
- End
- Begin VB.CommandButton Command2
- Caption = "取消添加"
- BeginProperty Font
- Name = "宋体"
- Size = 10.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 372
- Left = 2760
- TabIndex = 8
- Top = 1920
- Width = 1092
- End
- Begin VB.CommandButton Command1
- Caption = "确认添加"
- BeginProperty Font
- Name = "宋体"
- Size = 10.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 372
- Left = 960
- TabIndex = 7
- Top = 1920
- Width = 1092
- 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 = 3720
- TabIndex = 6
- Top = 1200
- Width = 1692
- 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 = 1200
- TabIndex = 4
- Top = 1200
- Width = 1332
- 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 = 1200
- TabIndex = 1
- Top = 480
- Width = 1332
- 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 = 2880
- TabIndex = 5
- Top = 1200
- 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 = 120
- TabIndex = 3
- Top = 1200
- Width = 972
- 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 = 2880
- TabIndex = 2
- Top = 480
- Width = 732
- 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 = 240
- TabIndex = 0
- Top = 480
- Width = 732
- End
- End
- Attribute VB_Name = "frmAddclassinfo"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- Dim mrc As ADODB.Recordset
- Dim MsgText As String
- Dim txtSQL As String
-
- If Not Testtxt(txtClassno.Text) Then
- MsgBox "请输入班号!", vbOKOnly + vbExclamation, "警告"
- txtClassno.SetFocus
- Exit Sub
- 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
-
- If Not IsNumeric(Trim(txtClassno.Text)) Then
- MsgBox "请输入数字!", vbOKOnly + vbExclamation, "警告"
- Exit Sub
- txtClassno.SetFocus
- End If
-
- txtSQL = "select * from class_Info "
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- mrc.MoveFirst
-
- While (mrc.EOF = False)
- If (Trim(mrc.Fields(0)) = Trim(txtClassno.Text)) Then
- MsgBox "班号已经存在,请重新输入班号!", vbOKOnly + vbExclamation, "警告"
- Exit Sub
- txtClassno.Text = ""
- txtClassno.SetFocus
- Else
- mrc.MoveNext
- End If
- Wend
-
- 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
- mrc.Close
- MsgBox "添加班级信息成功!", vbOKOnly + vbExclamation, "添加班级信息"
-
-
-
- End Sub
- Private Sub Command2_Click()
- Unload Me
- End Sub
- Private Sub Form_Load()
- comboGrade.AddItem "初中一年级"
- comboGrade.AddItem "初中二年级"
- comboGrade.AddItem "初中三年级"
- comboGrade.AddItem "高中一年级"
- comboGrade.AddItem "高中二年级"
- comboGrade.AddItem "高中三年级"
- End Sub