📄 formclass1.frm
字号:
VERSION 5.00
Begin VB.Form Formclass1
BorderStyle = 1 'Fixed Single
Caption = "添加班级"
ClientHeight = 4305
ClientLeft = 45
ClientTop = 330
ClientWidth = 5940
Icon = "Formclass1.frx":0000
LinkTopic = "Form2"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4305
ScaleWidth = 5940
Begin VB.CommandButton Command2
Caption = "取消"
Height = 255
Left = 3240
TabIndex = 13
Top = 3840
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 255
Left = 1440
TabIndex = 12
Top = 3840
Width = 1215
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 1215
Index = 6
Left = 1320
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 11
Text = "Formclass1.frx":0442
Top = 2400
Width = 3375
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 300
Index = 5
Left = 3600
MaxLength = 8
TabIndex = 9
Text = "Text1"
Top = 1920
Width = 1095
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 300
Index = 4
Left = 1320
MaxLength = 16
TabIndex = 7
Text = "Text1"
Top = 1920
Width = 1095
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 300
Index = 3
Left = 3600
MaxLength = 8
TabIndex = 6
Text = "Text1"
Top = 1320
Width = 1095
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 300
Index = 2
Left = 1320
MaxLength = 5
TabIndex = 5
Text = "Text1"
Top = 1320
Width = 1095
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 300
Index = 1
Left = 3600
MaxLength = 20
TabIndex = 3
Text = "Text1"
Top = 840
Width = 1095
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 300
Index = 0
Left = 1320
MaxLength = 16
TabIndex = 2
Text = "Text1"
Top = 840
Width = 1095
End
Begin VB.Label Label2
Caption = "班主任:"
ForeColor = &H00800000&
Height = 255
Index = 5
Left = 2760
TabIndex = 18
Top = 1920
Width = 735
End
Begin VB.Label Label2
Caption = "专业:"
ForeColor = &H00800000&
Height = 255
Index = 4
Left = 600
TabIndex = 17
Top = 1920
Width = 615
End
Begin VB.Label Label2
Caption = "年制:"
ForeColor = &H00800000&
Height = 255
Index = 3
Left = 2880
TabIndex = 16
Top = 1440
Width = 615
End
Begin VB.Label Label2
Caption = "教室:"
ForeColor = &H00800000&
Height = 255
Index = 2
Left = 600
TabIndex = 15
Top = 1440
Width = 615
End
Begin VB.Label Label2
Caption = "班级:"
ForeColor = &H00800000&
Height = 255
Index = 1
Left = 2880
TabIndex = 14
Top = 960
Width = 615
End
Begin VB.Label Label8
Caption = "备注:"
ForeColor = &H00800000&
Height = 255
Left = 600
TabIndex = 10
Top = 2520
Width = 615
End
Begin VB.Label Label7
Height = 255
Left = 2880
TabIndex = 8
Top = 2040
Width = 615
End
Begin VB.Label Label4
Height = 255
Left = 600
TabIndex = 4
Top = 1920
Width = 615
End
Begin VB.Label Label2
Caption = "年级:"
ForeColor = &H00800000&
Height = 255
Index = 0
Left = 600
TabIndex = 1
Top = 960
Width = 615
End
Begin VB.Label Label1
Caption = "班级设置"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2040
TabIndex = 0
Top = 240
Width = 1695
End
End
Attribute VB_Name = "Formclass1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim classstr As String
Public Sub classload()
Dim mrc As ADODB.Recordset
If classmodi Then '如果是修改状态
Me.Caption = "修改班级设置"
classstr = "select * from class where 班级='" & Trim(Formclass2.MSF1.TextMatrix(Formclass2.MSF1.Row, 2)) & "'"
Set mrc = ExecuteSQL(classstr)
mrc.MoveFirst
For i = 0 To 6
Text1(i).Text = mrc.Fields(i)
Next i
mrc.Close
Else
Me.Caption = "添加班级设置"
For i = 0 To 6
Text1(i).Text = ""
Next i
End If
End Sub
Private Sub Command1_Click()
For j = 0 To 5
If Text1(j) = "" Then
ss = MsgBox(Label2(j).Caption & "不能为空!", vbExclamation + vbOKOnly, "警告")
Text1(j).SetFocus
Text1(j).SelStart = 0
Text1(j).SelLength = Len(Text1(j).Text)
Exit Sub
End If
Next
Dim mrc As ADODB.Recordset
If classmodi = False Then
classstr = "select * from class where 班级='" & Trim(Text1(1).Text) & "'"
Set mrc = ExecuteSQL(classstr)
If mrc.EOF = False Then
sss = MsgBox("已经存在该班级的设置,不能重复!", vbonly, "警告")
Text1(1).SetFocus
Text1(1).SelStart = 0
Text1(1).SelLength = Len(Text1(1).Text)
mrc.Close
Exit Sub
End If
End If
classstr = "delete * from class where 班级='" & Trim(Text1(1).Text) & "'"
Set mrc = ExecuteSQL(classstr)
classstr = "select * from class "
Set mrc = ExecuteSQL(classstr)
mrc.AddNew
For i = 0 To 6
If Text1(6).Text = "" Then
Text1(6).Text = "无"
End If
mrc.Fields(i) = Text1(i).Text
Next i
mrc.Update
If classmodi Then
Unload Me
'Formclass2.classshowtitle
'Formclass2.classshowdata
Else
For j = 0 To 6
Text1(j) = ""
Next
'MDIForm1.classbrowse_Click
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Text1(0).SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -