form1.frm
字号:
Grid1.Cell(i, j).Text = qy1.Fields(j - 1)
End If
Next
qy1.MoveNext '读取下一记录
Next
Grid1.Column(1).Locked = True
If qy6.State = adStateOpen Then '表状态
qy6.Close
End If
qy6.Open "select * from 历史查询", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Do While qy6.EOF = False
If qy6.Fields(0) = Grid3.Cell(1, 2).Text Then
Exit Sub
End If
qy6.MoveNext
Loop
If qy6.EOF = True Then
qy6.AddNew
qy6.Fields(0) = Grid3.Cell(1, 2).Text
qy6.Fields(1) = Grid3.Cell(1, 1).Text
qy6.Update
End If
End If
End Sub
Private Sub XPButton14_Click()
Frame8.Visible = False
End Sub
Private Sub XPButton15_Click()
Frame8.Visible = True
Frame8.BackColor = RGB(97, 69, 133)
XPButton13.Default = True
Grid3.AllowUserResizing = False
Grid3.DisplayFocusRect = False
Grid3.ExtendLastCol = True
Grid3.Appearance = Flat
Grid3.FixedRowColStyle = Flat
Grid3.ScrollBarStyle = Flat
Grid3.DefaultFont.Name = "Tahoma"
Grid3.DefaultFont.SIZE = 8
Grid3.BackColorFixed = RGB(38, 51, 96)
Grid3.BackColorFixedSel = RGB(80, 38, 96)
Grid3.BackColorBkg = RGB(80, 38, 96)
Grid3.BackColorScrollBar = RGB(97, 69, 133)
Grid3.BackColor1 = RGB(97, 69, 133)
Grid3.BackColor2 = RGB(97, 69, 133)
Grid3.GridColor = RGB(148, 190, 231)
Grid3.BorderColor = RGB(97, 69, 133)
Grid3.Column(0).Width = 0
Grid3.Column(1).Width = 150
Grid3.Column(2).Width = 100
Grid3.Cell(0, 1).Text = "查询对象表名称"
Grid3.Cell(0, 2).Text = "查询条件(格式:字段名='?' and 字段名='?')"
Grid3.Column(1).CellType = cellComboBox
Grid3.Column(2).CellType = cellComboBox
Grid3.ComboBox(1).Clear
Grid3.ComboBox(1).AddItem "学生信息"
Grid3.ComboBox(1).AddItem "学生成绩"
End Sub
Private Sub XPButton16_Click()
If gridedit = False Then
MsgBox "当前修改操作不被允许!", vbInformation, "非使用对象"
Exit Sub
End If
If Grid1.Visible = True Then
For i = 1 To Grid1.Rows - 1
If qy1.State = adStateOpen Then '表状态
qy1.Close
End If
qy1.Open "select * from 学生信息 where 学号='" & Grid1.Cell(i, 1).Text & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
If qy1.EOF = False Then
For j = 1 To Grid1.Cols - 1
qy1.Fields(j - 1) = Grid1.Cell(i, j).Text
Next
qy1.Update
Else
MsgBox "学号为" + Grid1.Cell(i, 1).Text + "己经被删除,无法作出修改!", vbInformation, "数据将跳过"
End If
Next
MsgBox "修改的数据己经完成", vbInformation, "完成操作"
End If
If Grid2.Visible = True Then
For i = 1 To Grid2.Rows - 1
If qy1.State = adStateOpen Then '表状态
qy1.Close
End If
qy1.Open "select * from 学生成绩 where 学号='" & Grid2.Cell(i, 1).Text & "' and 学期='" & Grid2.Cell(i, 3).Text & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
If qy1.EOF = False Then
For j = 1 To Grid2.Cols - 1
qy1.Fields(j - 1) = Grid2.Cell(i, j).Text
Next
qy1.Update
End If
Next
MsgBox "修改的数据己经完成", vbInformation, "完成操作"
End If
End Sub
Private Sub XPButton17_Click()
If Grid1.Visible = True Then
CommonDialog1.ShowSave
CommonDialog1.Filter = "*.html"
Grid1.ExportToHTML (CommonDialog1.FileName)
MsgBox "导出成功!"
End If
If Grid2.Visible = True Then
CommonDialog1.ShowSave
CommonDialog1.Filter = "*.html"
Grid2.ExportToHTML (CommonDialog1.FileName)
MsgBox "导出成功!"
End If
End Sub
Private Sub XPButton2_Click()
If Frame3.Visible = True Then
Frame2.Top = XPButton1.Top + XPButton1.Height + 5
Frame2.Visible = True
Frame3.Visible = False
Frame4.Visible = False
Frame5.Visible = False
XPButton4.Top = XPButton5.Top - XPButton4.Height + 15
XPButton3.Top = XPButton5.Top - XPButton3.Height - XPButton4.Height + 15 * 2
XPButton2.Top = XPButton5.Top - XPButton2.Height - XPButton3.Height - XPButton4.Height + 15 * 3
Frame2.Height = XPButton2.Top - XPButton2.Height - XPButton6.Height + 15
Frame2.Left = 0
Frame2.Width = 1695
Exit Sub
End If
Frame3.Top = XPButton1.Height + XPButton2.Height + XPButton6.Height - 15 * 2
Frame3.Visible = True
Frame2.Visible = False
Frame4.Visible = False
Frame5.Visible = False
XPButton4.Top = XPButton5.Top - XPButton4.Height + 15
XPButton3.Top = XPButton5.Top - XPButton3.Height - XPButton4.Height + 15 * 2
XPButton2.Top = XPButton1.Top + XPButton1.Height - 15
Frame3.Height = XPButton3.Top - XPButton3.Height - XPButton4.Height - XPButton6.Height + 15 * 2
Frame3.Left = 0
Frame3.Width = 1695
Exit Sub
End Sub
Private Sub XPButton3_Click()
If Frame4.Visible = True Then
Frame3.Top = XPButton1.Height + XPButton2.Height + XPButton6.Height - 15 * 2
Frame3.Visible = True
Frame2.Visible = False
Frame4.Visible = False
Frame5.Visible = False
XPButton4.Top = XPButton5.Top - XPButton4.Height + 15
XPButton3.Top = XPButton5.Top - XPButton3.Height - XPButton4.Height + 15 * 2
XPButton2.Top = XPButton1.Top + XPButton1.Height - 15
Frame3.Height = XPButton3.Top - XPButton3.Height - XPButton4.Height - XPButton6.Height + 15 * 2
Frame3.Left = 0
Frame3.Width = 1695
Exit Sub
End If
Frame4.Top = XPButton1.Height + XPButton2.Height + XPButton3.Height + XPButton6.Height - 15 * 3
Frame4.Visible = True
Frame2.Visible = False
Frame3.Visible = False
Frame5.Visible = False
XPButton4.Top = XPButton5.Top - XPButton4.Height + 15
XPButton3.Top = XPButton1.Top + XPButton1.Height + XPButton2.Height - 15 * 2
XPButton2.Top = XPButton1.Top + XPButton1.Height - 15
Frame4.Height = XPButton4.Top - Frame4.Top
Frame4.Left = 0
Frame4.Width = 1695
Exit Sub
End Sub
Private Sub XPButton4_Click()
If Frame5.Visible = True Then
Frame4.Top = XPButton1.Height + XPButton2.Height + XPButton3.Height + XPButton6.Height - 15 * 3
Frame4.Visible = True
Frame2.Visible = False
Frame3.Visible = False
Frame5.Visible = False
XPButton4.Top = XPButton5.Top - XPButton4.Height + 15
XPButton3.Top = XPButton1.Top + XPButton1.Height + XPButton2.Height - 15 * 2
XPButton2.Top = XPButton1.Top + XPButton1.Height - 15
Frame4.Height = XPButton4.Top - Frame4.Top
Frame4.Left = 0
Frame4.Width = 1695
Exit Sub
End If
Frame5.Top = XPButton1.Height + XPButton2.Height + XPButton3.Height + XPButton4.Height + XPButton6.Height - 15 * 4
Frame5.Visible = True
Frame2.Visible = False
Frame3.Visible = False
Frame4.Visible = False
XPButton4.Top = XPButton1.Height + XPButton2.Height + XPButton3.Height + XPButton6.Height - 15 * 4
XPButton3.Top = XPButton1.Top + XPButton1.Height + XPButton2.Height - 15 * 2
XPButton2.Top = XPButton1.Top + XPButton1.Height - 15
Frame5.Height = XPButton5.Top - Frame5.Top
Frame5.Left = 0
Frame5.Width = 1695
Exit Sub
End Sub
Private Sub Form_Load()
form1.Picture = LoadPicture(App.Path & "\images\imagemain.jpg")
Label1.Caption = "欢迎用户" + loginname + "进入学生信息管理系统!"
form1.Caption = "学生信息管理系统 当前用户:" + loginname + " 权限:" + useradmin
Grid1.AllowUserResizing = True
Grid1.DisplayFocusRect = False
Grid1.ExtendLastCol = True
Grid1.Appearance = Flat
Grid1.FixedRowColStyle = Flat
Grid1.ScrollBarStyle = Flat
Grid1.DefaultFont.Name = "Tahoma"
Grid1.DefaultFont.SIZE = 8
Grid1.BackColorFixed = RGB(90, 158, 214)
Grid1.BackColorFixedSel = RGB(110, 180, 230)
Grid1.BackColorBkg = RGB(90, 158, 214)
Grid1.BackColorScrollBar = RGB(231, 235, 247)
Grid1.BackColor1 = RGB(231, 235, 247)
Grid1.BackColor2 = RGB(239, 243, 255)
Grid1.GridColor = RGB(148, 190, 231)
Grid1.Column(0).Width = 0
Grid1.Column(1).Width = 100
Grid1.Column(2).Width = 80
Grid1.Column(3).Width = 45
Grid1.Column(4).Width = 45
Grid1.Column(5).Width = 80
Grid1.Column(6).Width = 100
Grid1.Column(7).Width = 100
Grid2.AllowUserResizing = True
Grid2.DisplayFocusRect = False
Grid2.ExtendLastCol = True
Grid2.Appearance = Flat
Grid2.FixedRowColStyle = Flat
Grid2.ScrollBarStyle = Flat
Grid2.DefaultFont.Name = "Tahoma"
Grid2.DefaultFont.SIZE = 8
Grid2.BackColorFixed = RGB(90, 158, 214)
Grid2.BackColorFixedSel = RGB(110, 180, 230)
Grid2.BackColorBkg = RGB(90, 158, 214)
Grid2.BackColorScrollBar = RGB(231, 235, 247)
Grid2.BackColor1 = RGB(231, 235, 247)
Grid2.BackColor2 = RGB(239, 243, 255)
Grid2.GridColor = RGB(148, 190, 231)
Grid2.Column(0).Width = 0
Grid2.Column(1).Width = 100
Grid2.Column(2).Width = 100
Grid2.Column(3).Width = 80
Grid2.Column(4).Width = 80
Grid2.Column(5).Width = 80
Grid2.Column(6).Width = 120
Grid2.Column(7).Width = 80
Grid2.Top = Grid1.Top
Grid2.Width = Grid1.Width
Grid2.Left = Grid1.Left
Grid2.Height = Grid1.Height
'------------------------------------------------
Grid1.Column(3).CellType = cellComboBox
Grid1.Column(4).CellType = cellComboBox
Grid1.Column(5).CellType = cellCalendar
Grid1.Column(6).CellType = cellComboBox
Grid1.Column(7).CellType = cellComboBox
Grid1.Column(9).CellType = cellCheckBox
Grid1.Column(10).CellType = cellComboBox
Grid1.Column(11).CellType = cellComboBox
'---------------------------------------------------
Frame2.Visible = False
Frame3.Visible = False
Frame4.Visible = False
Frame5.Visible = False
Frame6.Visible = False
Frame8.Visible = False
Grid1.Visible = False
End Sub
Private Sub XPButton5_Click()
Frame5.Top = XPButton1.Height + XPButton2.Height + XPButton3.Height + XPButton4.Height + XPButton6.Height - 15 * 4
Frame5.Visible = True
Frame2.Visible = False
Frame3.Visible = False
Frame4.Visible = False
XPButton4.Top = XPButton1.Height + XPButton2.Height + XPButton3.Height + XPButton6.Height - 15 * 4
XPButton3.Top = XPButton1.Top + XPButton1.Height + XPButton2.Height - 15 * 2
XPButton2.Top = XPButton1.Top + XPButton1.Height - 15
Frame5.Height = XPButton5.Top - Frame5.Top
Frame5.Left = 0
Frame5.Width = 1695
End Sub
Private Sub XPButton7_Click()
If Frame6.Visible = True Then
Frame6.Visible = False
Exit Sub
End If
If yuzhi = False Then
MsgBox "当前对象不支持预置操作!", vbInformation, "不支持对象"
Exit Sub
End If
Frame6.Visible = True
Frame6.BackColor = RGB(97, 69, 133)
Text1.BackColor = Frame6.BackColor
Text1.SetFocus
XPButton9.Default = True
End Sub
Private Sub XPButton8_Click()
If gridsave = False Then
MsgBox "当前不支持保存,请执行其它操作", vbInformation, "操作不被允许"
Exit Sub
End If
If Grid1.Visible = True Then
If dbase = "新生入学" Then
For i = 1 To Grid1.Rows - 1
If Grid1.Cell(i, 1).Text <> "" And Grid1.Cell(i, 2).Text <> "" Then
If qy1.State = adStateOpen Then '表状态
qy1.Close
End If
qy1.Open "select * from 学生信息 where 学号='" & Grid1.Cell(i, 1).Text & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
If qy1.EOF = True Then
qy1.AddNew
For j = 1 To Grid1.Cols - 1
qy1.Fields(j - 1) = Grid1.Cell(i, j).Text
Next
qy1.Update
For t = 1 To Grid1.Cell(i, 11).Text
If qy5.State = adStateOpen Then '表状态
qy5.Close
End If
qy5.Open "select * from 学生成绩", cnn, adOpenKeyset, adLockOptimistic, adCmdText
For Y = 1 To 2
qy5.AddNew
qy5.Fields(0) = Grid1.Cell(i, 1).Text
qy5.Fields(1) = Grid1.Cell(i, 2).Text
If Y = 1 Then
qy5.Fields(2) = Year(Grid1.Cell(1, 5).Text) + t & "年上学期"
Else
qy5.Fields(2) = Year(Grid1.Cell(1, 5).Text) + t & "年下学期"
End If
qy5.Fields(3) = ""
qy5.Fields(4) = ""
qy5.Fields(5) = ""
qy5.Fields(6) = ""
qy5.Fields(7) = ""
qy5.Update
Next
Next
Else
Label1.Caption = "学号" & Grid1.Cell(i, 1).Text & "己存在,系统自动跳过,输入数据不成功!"
End If
Else
Label1.Caption = "第" & i & "的学号或姓名为空值,系统自动跳过,输入数据不成功!"
End If
Next
MsgBox "程序输入成功!", vbInformation, "保存成功"
End If
End If
End Sub
Private Sub XPButton9_Click()
If Text1.Text <> "" Then
If dbase = "新生入学" Then
Call asPopup1_Click(True)
Grid1.Rows = Int(Text1.Text) + 1 '设置多行
End If
End If
Text1.Text = ""
Frame6.Visible = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -