VB人事管理系统论文+数据流程图+ER图+功能模块图 第7页
图6.4教师信息表界面
代码如下:
Private WithEvents PrimaryCLS As cls教师
Dim mbChangedByCode As Boolean
Dim mvBookMark As Variant
Dim mbEditFlag As Boolean
Dim mbAddNewFlag As Boolean
Dim mbDataChanged As Boolean
Private Sub Form_Load()
Set PrimaryCLS = New cls教师
grdDataGrid.DataMember = "Primary"
Set grdDataGrid.DataSource = PrimaryCLS
End Sub
Private Sub Form_Resize()
On Error Resume Next
grdDataGrid.Height = Me.ScaleHeight - 30 - picButtons.Height - picStatBox.Height
lblStatus.Width = Me.Width - 1500
cmdNext.Left = lblStatus.Width + 700
cmdLast.Left = cmdNext.Left + 340
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If mbEditFlag Or mbAddNewFlag Then Exit Sub
Select Case KeyCode
Case vbKeyEscape
cmdClose_Click
Case vbKeyEnd
cmdLast_Click
Case vbKeyHome
cmdFirst_Click
Case vbKeyUp, vbKeyPageUp
If Shift = vbCtrlMask Then
cmdFirst_Click
Else
cmdPrevious_Click
End If
Case vbKeyDown, vbKeyPageDown
If Shift = vbCtrlMask Then
cmdLast_Click
Else
cmdNext_Click
End If
End Select
End Sub
Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
End Sub
Private Sub PrimaryCLS_MoveComplete()
lblStatus.Caption = "Record: " & CStr(PrimaryCLS.AbsolutePosition)
End Sub
(1)添加代码
Private Sub cmdAdd_Click()
On Error GoTo AddErr
PrimaryCLS.MoveLast
PrimaryCLS.AddNew
grdDataGrid.SetFocus
Exit Sub
AddErr:
MsgBox Err.Description
End Sub
(2)删除代码
Private Sub cmdDelete_Click()
On Error GoTo DeleteErr
PrimaryCLS.Delete
Exit Sub
DeleteErr:
MsgBox Err.Description
End Sub
(3)编辑代码
Private Sub cmdEdit_Click()
On Error GoTo EditErr
lblStatus.Caption = "编辑记录"
mbEditFlag = True
SetButtons False
Exit Sub
EditErr:
MsgBox Err.Description
End Sub
Private Sub cmdCancel_Click()
On Error Resume Next
PrimaryCLS.Cancel
SetButtons True
End Sub
(4)更新代码
Private Sub cmdUpdate_Click()
On Error GoTo UpdateErr
PrimaryCLS.Update
SetButtons True
Exit Sub
UpdateErr:
MsgBox Err.Description
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdFirst_Click()
On Error GoTo GoFirstError
PrimaryCLS.MoveFirst
mbDataChanged = False
Exit Sub
GoFirstError:
MsgBox Err.Description
End Sub
Private Sub cmdLast_Click()
On Error GoTo GoLastError
PrimaryCLS.MoveLast
mbDataChanged = False
Exit Sub
GoLastError:
MsgBox Err.Description
End Sub
Private Sub cmdNext_Click()
On Error GoTo GoNextError
PrimaryCLS.MoveNext
Exit Sub
GoNextError:
MsgBox Err.Description
End Sub
Private Sub cmdPrevious_Click()
On Error GoTo GoPrevError
PrimaryCLS.MovePrevious
Exit Sub
GoPrevError:
MsgBox Err.Description
End Sub
Private Sub SetButtons(bVal As Boolean)
cmdAdd.Visible = bVal
cmdUpdate.Visible = Not bVal
cmdCancel.Visible = Not bVal
cmdDelete.Visible = bVal
cmdClose.Visible = bVal
cmdNext.Enabled = bVal
cmdFirst.Enabled = bVal
cmdLast.Enabled = bVal
cmdPrevious.Enabled = bVal
End Sub
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页
VB人事管理系统论文+数据流程图+ER图+功能模块图 第7页下载如图片无法显示或论文不完整,请联系qq752018766