📄 frmstsi.frm
字号:
MSFlexGrid1.TextMatrix(j, 1) = Trim(Text1(1))
MSFlexGrid1.TextMatrix(j, 2) = Trim(Text1(2))
MSFlexGrid1.TextMatrix(j, 3) = Trim(Text1(3))
MSFlexGrid1.TextMatrix(j, 4) = Trim(Text1(4))
MSFlexGrid1.TextMatrix(j, 5) = Trim(Text1(5))
MSFlexGrid1.TextMatrix(j, 6) = Trim(Text1(6))
MSFlexGrid1.TextMatrix(j, 7) = Trim(Text1(7))
If Text1(8) <> Label2(8).Caption Then
MSFlexGrid1.TextMatrix(j, 8) = Trim(Text1(8))
End If
End If
MSFlexGrid1.TopRow = j
j = 0
TextDcolor
End Sub
Private Sub Command4_Click()
Dim txtSQL As String
Dim j As Integer
txtSQL = "delete from student_Form where student_NO='" & Trim(Text1(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
MsgBox "学籍信息已经删除!", vbOKOnly, "提示"
j = 0
For i = 1 To MSFlexGrid1.Rows - 1
If MSFlexGrid1.TextMatrix(i, 0) = Text1(0) Then
j = i
End If
Next
If j <> 0 Then
MSFlexGrid1.TextMatrix(j, 0) = "已删除"
MSFlexGrid1.TextMatrix(j, 1) = "已删除"
MSFlexGrid1.TextMatrix(j, 2) = "已删除"
MSFlexGrid1.TextMatrix(j, 3) = "已删除"
MSFlexGrid1.TextMatrix(j, 4) = "已删除"
MSFlexGrid1.TextMatrix(j, 5) = "已删除"
MSFlexGrid1.TextMatrix(j, 6) = "已删除"
MSFlexGrid1.TextMatrix(j, 7) = "已删除"
MSFlexGrid1.TextMatrix(j, 8) = "已删除"
End If
j = 0
TextDcolor
Text1(1).Enabled = False
Text1(2).Enabled = False
Text1(3).Enabled = False
Combo1.Enabled = False
Text1(4).Enabled = False
Text1(5).Enabled = False
Text1(6).Enabled = False
Text1(7).Enabled = False
Text1(8).Enabled = False
End Sub
Private Sub Command5_Click()
TextDcolor
If Label1(1).BackColor = &HFFFFFF Then
MSFlexGrid1.Clear
ShowTitle
Text1(4).Visible = True
Combo1.Visible = False
Text1(2).Enabled = False
Text1(3).Enabled = False
Text1(7).Enabled = False
Text1(8).Enabled = False
End If
If Label1(3).BackColor = &HFFFFFF Then
Text1(1).Enabled = False
Text1(2).Enabled = False
Text1(3).Enabled = False
Combo1.Enabled = False
Text1(4).Enabled = False
Text1(5).Enabled = False
Text1(6).Enabled = False
Text1(7).Enabled = False
Text1(8).Enabled = False
End If
End Sub
Private Sub Form_Load()
Me.Caption = "学籍信息->查 询"
ShowTitle
Label1(1).BackColor = &HFFFFFF
TextDcolor
Text1(4).Visible = True
Combo1.Visible = False
Command1.Visible = False
Command2.Visible = True
Command3.Visible = False
Command4.Visible = False
Text1(2).Enabled = False
Text1(3).Enabled = False
Text1(7).Enabled = False
Text1(8).Enabled = False
End Sub
Private Sub Form_Resize()
dColor.ZOrder 1
End Sub
Private Sub TextDcolor()
Dim txtSQL As String
For i = 0 To 8
Text1(i).Enabled = True
Combo1.Enabled = True
Text1(i).BackColor = &HE0E0E0
Text1(i) = Label2(i).Caption
If i = 7 Or i = 8 Then
Text1(i).Height = 300
End If
Next
Text1(4).Visible = False
Combo1.Visible = True
Combo1.Clear
Combo1.AddItem Label2(4).Caption
Combo1.BackColor = &HE0E0E0
Combo1.ListIndex = 0
txtSQL = "select * from class_Form"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "请先进行班级设置!", vbOKOnly, "提示"
Else
With Combo1
Do While Not mrc.EOF
.AddItem Trim(mrc!class_NO)
mrc.MoveNext
Loop
End With
End If
End Sub
Private Sub Label1_Click(Index As Integer)
Me.Caption = "学籍信息->"
Me.Caption = Me.Caption & Trim(Label1(Index).Caption)
Label1(0).BackColor = &HE0E0E0
Label1(1).BackColor = &HE0E0E0
Label1(2).BackColor = &HE0E0E0
Label1(3).BackColor = &HE0E0E0
Label1(Index).BackColor = &HFFFFFF
Label2(4).Caption = "在此选择学号"
Label2(5).Caption = "在此输入联系电话"
Label2(6).Caption = "在此输入入学日期"
Command5.SetFocus
If Index = 0 Then
TextDcolor
Command1.Visible = True
Command2.Visible = False
Command3.Visible = False
Command4.Visible = False
End If
If Index = 1 Then
Label2(4).Caption = "在此输入学生学号"
Label2(5).Caption = "查询入学日期起始"
Label2(6).Caption = "查询入学日期截止"
TextDcolor
Text1(4).Visible = True
Combo1.Visible = False
Command1.Visible = False
Command2.Visible = True
Command3.Visible = False
Command4.Visible = False
Text1(2).Enabled = False
Text1(3).Enabled = False
Text1(7).Enabled = False
Text1(8).Enabled = False
End If
If Index = 2 Then
TextDcolor
Text1(0).SetFocus
Command1.Visible = False
Command2.Visible = False
Command3.Visible = True
Command4.Visible = False
End If
If Index = 3 Then
TextDcolor
Text1(0).SetFocus
Command1.Visible = False
Command2.Visible = False
Command3.Visible = False
Command4.Visible = True
Text1(1).Enabled = False
Text1(2).Enabled = False
Text1(3).Enabled = False
Combo1.Enabled = False
Text1(4).Enabled = False
Text1(5).Enabled = False
Text1(6).Enabled = False
Text1(7).Enabled = False
Text1(8).Enabled = False
End If
End Sub
Private Sub MSFlexGrid1_Click()
If Label1(2).BackColor = &HFFFFFF Or Label1(3).BackColor = &HFFFFFF Then
If MSFlexGrid1.Row <> 0 Then
For i = 0 To 8
Text1(i) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, i)
Next
If Label1(2).BackColor = &HFFFFFF Then
For i = 0 To 8
Text1(i).BackColor = &H8000000E
Next
End If
If Label1(3).BackColor = &HFFFFFF Then
Text1(0).BackColor = &H8000000E
End If
Text1(7).Height = 600
Text1(8).Height = 600
End If
End If
End Sub
Private Sub Text1_Change(Index As Integer)
If Label1(2).BackColor = &HFFFFFF Or Label1(3).BackColor = &HFFFFFF Then
If Index = 0 Then
tSQL = "select * from student_Form where student_NO='" & Trim(Text1(Index)) & "'"
Set mrc = ExecuteSQL(tSQL, MsgText)
If mrc.EOF = False Then
For i = 1 To 8
Text1(i) = mrc.Fields(i)
Next
Combo1.Clear
Combo1.AddItem Text1(4)
Combo1.ListIndex = 0
txtSQL = "select * from class_Form"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
With Combo1
Do While Not mrc.EOF
.AddItem Trim(mrc!class_NO)
mrc.MoveNext
Loop
End With
End If
If Label1(2).BackColor = &HFFFFFF Then
For i = 1 To 8
Text1(i).BackColor = &H8000000E
Next
Combo1.BackColor = &H8000000E
End If
Text1(7).Height = 600
Text1(8).Height = 600
Command3.Enabled = True
Command4.Enabled = True
Exit Sub
Else
For i = 1 To 8
Text1(i) = Label2(i).Caption
Next
Combo1.Clear
Combo1.AddItem Label2(4).Caption
Combo1.ListIndex = 0
If Label1(2).BackColor = &HFFFFFF Then
For i = 1 To 8
Text1(i).BackColor = &HE0E0E0
Next
Combo1.BackColor = &HE0E0E0
End If
Text1(7).Height = 300
Text1(8).Height = 300
Command3.Enabled = False
Command4.Enabled = False
End If
mrc.Close
End If
End If
End Sub
Private Sub Text1_Click(Index As Integer)
If Index = 2 Then
If Text1(Index) = "男" Then
Text1(Index) = "女"
Else
Text1(Index) = "男"
End If
End If
End Sub
Private Sub Text1_GotFocus(Index As Integer)
If Text1(Index) = Label2(Index).Caption Then
Text1(Index).BackColor = &H8000000E
Text1(Index) = ""
If Index = 7 Or Index = 8 Then
Text1(Index).Height = 600
End If
End If
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
Private Sub Text1_LostFocus(Index As Integer)
If Text1(Index) = "" Then
Text1(Index).BackColor = &HE0E0E0
Text1(Index) = Label2(Index).Caption
If Index = 7 Or Index = 8 Then
Text1(Index).Height = 300
End If
End If
End Sub
Private Sub ShowTitle()
Dim i As Integer
With MSFlexGrid1
.Cols = 9
.TextMatrix(0, 0) = "学号"
.TextMatrix(0, 1) = "姓名"
.TextMatrix(0, 2) = "性别"
.TextMatrix(0, 3) = "出生日期"
.TextMatrix(0, 4) = "学生编号"
.TextMatrix(0, 5) = "联系电话"
.TextMatrix(0, 6) = "入学日期"
.TextMatrix(0, 7) = "家庭住址"
.TextMatrix(0, 8) = "备注信息"
.ColWidth(0) = 1000
.ColWidth(1) = 1000
.ColWidth(2) = 1000
.ColWidth(3) = 1200
.ColWidth(4) = 1200
.ColWidth(5) = 1200
.ColWidth(6) = 1200
.ColWidth(7) = 3000
.ColWidth(8) = 6000
.Rows = 1
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -