📄 frmclai.frm
字号:
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "备注信息"
Height = 255
Index = 3
Left = 480
TabIndex = 33
Top = 1680
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "班级编号"
Height = 255
Index = 0
Left = 480
TabIndex = 26
Top = 240
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "班级名称"
Height = 255
Index = 1
Left = 480
TabIndex = 25
Top = 720
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "导员姓名"
Height = 255
Index = 2
Left = 480
TabIndex = 24
Top = 1200
Width = 975
End
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 3810
Left = 240
TabIndex = 18
Top = 720
Width = 6015
_ExtentX = 10610
_ExtentY = 6720
_Version = 393216
Cols = 4
FixedCols = 0
BackColorFixed = 14737632
BackColorBkg = -2147483643
Appearance = 0
End
Begin VB.Label Label2
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = " 删 除"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 375
Index = 2
Left = 9120
TabIndex = 22
Top = 360
Width = 1335
End
Begin VB.Label Label2
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = " 修 改"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 375
Index = 1
Left = 7800
TabIndex = 21
Top = 360
Width = 1335
End
Begin VB.Label Label2
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = " 添 加"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 375
Index = 0
Left = 6480
TabIndex = 20
Top = 360
Width = 1335
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Caption = " 班 级 信 息 列 表"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 375
Left = 240
TabIndex = 19
Top = 360
Width = 6015
End
End
Attribute VB_Name = "frmclai"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim tSQL As String
Private Sub Command1_Click()
If Text1(0) = "" Then
MsgBox "班级编号不能为空!", vbOKOnly, "提示"
Text1(0).SetFocus
Exit Sub
End If
If Text1(1) = "" Then
MsgBox "班级名称不能为空!", vbOKOnly, "提示"
Text1(1).SetFocus
Exit Sub
End If
If Text1(2) = "" Then
MsgBox "导员姓名不能为空!", vbOKOnly, "提示"
Text1(2).SetFocus
Exit Sub
End If
txtSQL = "select * from class_Form where class_NO='" & Trim(Text1(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
MsgBox "此班级编号已存在!", vbOKOnly, "警告"
Text1(0).SetFocus
Exit Sub
End If
mrc.Close
txtSQL = "select * from class_Form"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = Trim(Text1(0))
mrc.Fields(1) = Trim(Text1(1))
mrc.Fields(2) = Trim(Text1(2))
mrc.Fields(3) = Trim(Text1(3))
mrc.Update
mrc.Close
For i = 0 To 3
Text1(i) = ""
Next
MsgBox "班级信息添加成功!", vbOKOnly, "提示"
ShowData
End Sub
Private Sub Command2_Click()
For i = 0 To 3
Text1(i) = ""
Next
End Sub
Private Sub Command3_Click()
If Text1(5) = "" Then
MsgBox "班级名称不能为空!", vbOKOnly, "提示"
Text1(5).SetFocus
Exit Sub
End If
If Text1(6) = "" Then
MsgBox "导员姓名不能为空!", vbOKOnly, "提示"
Text1(6).SetFocus
Exit Sub
End If
txtSQL = "delete from class_Form where class_NO='" & Trim(Text1(4)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
txtSQL = "select * from class_Form"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = Trim(Text1(4))
mrc.Fields(1) = Trim(Text1(5))
mrc.Fields(2) = Trim(Text1(6))
mrc.Fields(3) = Trim(Text1(7))
mrc.Update
mrc.Close
For i = 4 To 7
Text1(i) = ""
Next
MsgBox "班级信息修改成功!", vbOKOnly, "提示"
ShowData
End Sub
Private Sub Command4_Click()
For i = 4 To 7
Text1(i) = ""
Next
End Sub
Private Sub Command5_Click()
txtSQL = "delete from class_Form where class_NO='" & Trim(Text1(8)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
For i = 8 To 11
Text1(i) = ""
Next
MsgBox "班级信息以经删除!", vbOKOnly, "警告"
ShowData
End Sub
Private Sub Command6_Click()
For i = 8 To 11
Text1(i) = ""
Next
End Sub
Private Sub Form_Load()
Me.Caption = "班级信息->添 加"
Picture1(1).Top = Picture1(0).Top
Picture1(1).Left = Picture1(0).Left
Picture1(2).Top = Picture1(0).Top
Picture1(2).Left = Picture1(0).Left
ShowData
For i = 0 To 2
Label2(i).BackColor = &HE0E0E0
Picture1(i).Visible = False
Next
Label2(0).BackColor = &HFFFFFF
Picture1(0).Visible = True
End Sub
Private Sub Form_Resize()
dColor.ZOrder 1
End Sub
Private Sub Label2_Click(Index As Integer)
Me.Caption = "班级信息"
Me.Caption = Me.Caption & "->" & Trim(Label2(Index).Caption)
For i = 0 To 2
Label2(i).BackColor = &HE0E0E0
Picture1(i).Visible = False
Next
Label2(Index).BackColor = &HFFFFFF
Picture1(Index).Visible = True
For i = 0 To 11
Text1(i) = ""
Next
Command3.Enabled = False
Command5.Enabled = False
End Sub
Private Sub ShowData()
Dim txSQL As String
Dim mrcc As ADODB.Recordset
txSQL = "select * from class_Form"
Set mrcc = ExecuteSQL(txSQL, MsgText)
With MSFlexGrid1
.ColWidth(0) = 1200
.ColWidth(1) = 1200
.ColWidth(2) = 1200
.ColWidth(3) = 6000
.TextMatrix(0, 0) = "班级编号"
.TextMatrix(0, 1) = "班级名称"
.TextMatrix(0, 2) = "导员姓名"
.TextMatrix(0, 3) = "备注信息"
.Rows = 1
Do While Not mrcc.EOF
.Rows = .Rows + 1
For i = 0 To mrcc.Fields.Count - 1
.TextMatrix(.Rows - 1, i) = mrcc.Fields(i) & ""
Next i
mrcc.MoveNext
Loop
End With
mrcc.Close
End Sub
Private Sub MSFlexGrid1_Click()
If Picture1(1).Visible = True Then
Text1(4) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0))
Text1(5) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1))
Text1(6) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2))
Text1(7) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 3))
Command3.Enabled = True
End If
If Picture1(2).Visible = True Then
Text1(8) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0))
Text1(9) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1))
Text1(10) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2))
Text1(11) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 3))
Command5.Enabled = True
End If
End Sub
Private Sub Text1_Change(Index As Integer)
If Index = 4 Then
tSQL = "select * from class_Form where class_NO='" & Trim(Text1(Index)) & "'"
Set mrc = ExecuteSQL(tSQL, MsgText)
If mrc.EOF = False Then
Text1(5) = mrc.Fields(1)
Text1(6) = mrc.Fields(2)
Text1(7) = mrc.Fields(3)
Command3.Enabled = True
Exit Sub
Else
Text1(5) = ""
Text1(6) = ""
Text1(7) = ""
Command3.Enabled = False
End If
mrc.Close
End If
If Index = 8 Then
tSQL = "select * from class_Form where class_NO='" & Trim(Text1(Index)) & "'"
Set mrc = ExecuteSQL(tSQL, MsgText)
If mrc.EOF = False Then
Text1(9) = mrc.Fields(1)
Text1(10) = mrc.Fields(2)
Text1(11) = mrc.Fields(3)
Command5.Enabled = True
Exit Sub
Else
Text1(9) = ""
Text1(10) = ""
Text1(11) = ""
Command5.Enabled = False
End If
mrc.Close
End If
End Sub
Private Sub Text1_GotFocus(Index As Integer)
Text1(Index).SelStart = 0
Text1(Index).SelLength = Len(Text1(Index))
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -