Private Sub XPButton4_Click()
If ksdel = False Then
MsgBox "当前删除操作不被允许!", vbInformation, "非使用对象"
Exit Sub
End If
If hang = 0 Then
Exit Sub
End If
If Grid1.Cell(hang, 1).Text = "" Then
Exit Sub
End If
Set ks1 = cnn.Execute("delete from " & kstable & " where " & ks1.Fields(0).Name & "='" & Grid1.Cell(hang, 1).Text & "'")
MsgBox "目标己删除,请刷新数据!", vbInformation, "删除成功"
Call callmain
End Sub
Private Sub XPButton5_Click()
Unload Me
End Sub
(7)系统设定界面
系统设计界面如图14所示,界面右端有菜单按钮选项,其中包括增加,保存,删除和退出,其应用操作如图
图15 系统设定界面
Dim i As Integer
Private Declare Function GetKeyState Lib "user32" _
(ByVal nVirtKey As Long) As Integer
Dim gcolor1, gcolor2 As String
Dim m, n As Integer
Private Sub Form_Load()
Grid1.SetRegisterInformation "CNwinndy", "W]vyY-nonvk-u\nty-Zbl_e-`hms^" '进行注册
With Grid1
.AllowUserResizing = True
.DisplayFocusRect = False
.ExtendLastCol = True
.Appearance = Flat
.FixedRowColStyle = Flat
.ScrollBarStyle = Flat
.BackColor1 = RGB(231, 235, 247)
.BackColor2 = RGB(239, 243, 255)
.GridColor = RGB(148, 190, 231)
.Column(0).Width = 0
.Column(1).Width = 100
.Column(2).Width = 100
End With
Me.BackColor = RGB(84, 201, 134)
kstable = "日程设定"
Call callmain
End Sub
Private Sub callmain()
kssave = False
ksedit = True
ksdel = True
Set ks1 = cnn.Execute("select * from " & kstable)
Grid1.Rows = 1 '清除所有记录
i = 2
Grid1.Cols = i + 1 '必须+1,因为实际上为4行,但第一行是隐藏的
For i = 0 To i - 1 '显示数据的字段名
Grid1.Cell(0, i + 1).Text = ks1.Fields(i).Name '读取表中的各字段名
Next
n = i
i = 1
Do While Not ks1.EOF
Grid1.Rows = Grid1.Rows + 1
For j = 1 To n '设定读取列
If ks1.Fields(j - 1) = Null Then '空值的处理
Grid1.Cell(i, j).Text = ""
Else
Grid1.Cell(i, j).Text = ks1.Fields(j - 1)
End If
Next
i = i + 1
ks1.MoveNext '读取下一记录
Private Sub Grid1_Validate(Cancel As Boolean) '设定TAB键切换
Dim nActiveRow As Long, nActiveCol As Long
Const VK_TAB = 9
End Sub
Private Sub renovate_Click()
Call callmain
End Sub
Private Sub XPButton1_Click()
kssave = True
Set ks1 = cnn.Execute("select * from " & kstable)
Grid1.Rows = 1 '清除所有记录
Grid1.Rows = 21 '默认为2行
Grid1.Column(1).CellType = cellCalendar
For i = 0 To 1 '显示数据的字段名
Grid1.Cell(0, i + 1).Text = ks1.Fields(i).Name '读取表中的各字段名
Next
Grid1.Column(1).Locked = False
Grid1.Cell(1, 1).SetFocus
XPButton2.Default = True
End Sub
Private Sub XPButton3_Click()
If ksdel = False Then
MsgBox "当前删除操作不被允许!", vbInformation, "非使用对象"
Exit Sub
End If
If hang = 0 Then
Exit Sub
End If
If Grid1.Cell(hang, 1).Text = "" Then
Exit Sub
End If
Set ks1 = cnn.Execute("delete from " & kstable & " where " & ks1.Fields(0).Name & "='" & Grid1.Cell(hang, 1).Text & "' and " & ks1.Fields(1).Name & "='" & Grid1.Cell(hang, 2).Text & "'")
MsgBox "目标己删除,请刷新数据!", vbInformation, "删除成功"
Call callmain
End Sub
Private Sub XPButton5_Click()
Unload Me
End Sub
(8)教师管理窗体
当我们进入教师管理窗体时,其界面如图15所示,其中可以对教师的各项信息进行增加,保存和删除等操作
图16 教师管理窗体界面
Dim i As Integer
Private Declare Function GetKeyState Lib "user32" _
(ByVal nVirtKey As Long) As Integer
Dim gcolor1, gcolor2 As String
Dim m, n As Integer
Private Sub Form_Load()
Grid1.SetRegisterInformation "CNwinndy", "W]vyY-nonvk-u\nty-Zbl_e-`hms^" '进行注册
With Grid1
.AllowUserResizing = True
.ScrollBarStyle = Flat
.DefaultFont.Name = "Tahoma"
.BackColor1 = RGB(231, 235, 247)
.BackColor2 = RGB(239, 243, 255)
.GridColor = RGB(148, 190, 231)
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页