📄 frmstuffinforesult.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmstuffinfoResult
Caption = "员工基本信息列表"
ClientHeight = 7305
ClientLeft = 60
ClientTop = 345
ClientWidth = 11625
ControlBox = 0 'False
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 7305
ScaleWidth = 11625
WindowState = 2 'Maximized
Begin VB.CommandButton Command5
Caption = "退 出"
Height = 360
Left = 10080
TabIndex = 6
Top = 6600
Width = 1260
End
Begin VB.CommandButton Command4
Caption = "查询员工信息"
Height = 360
Left = 3720
TabIndex = 5
Top = 6600
Width = 1380
End
Begin VB.CommandButton Command3
Caption = "修改员工信息"
Height = 360
Left = 8400
TabIndex = 4
Top = 6600
Width = 1260
End
Begin VB.CommandButton Command2
Caption = "删除员工信息"
Height = 360
Left = 6960
TabIndex = 3
Top = 6600
Width = 1260
End
Begin VB.CommandButton Command1
Caption = "添加员工信息"
Height = 360
Left = 5280
TabIndex = 2
Top = 6600
Width = 1500
End
Begin MSFlexGridLib.MSFlexGrid rsGrid
Height = 5445
Left = 0
TabIndex = 0
Top = 720
Width = 15000
_ExtentX = 26458
_ExtentY = 9604
_Version = 393216
Cols = 18
FixedCols = 0
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Frame Frame1
Height = 735
Left = 3600
TabIndex = 7
Top = 6360
Width = 7935
End
Begin VB.Label Label1
Caption = "员工基本信息列表"
BeginProperty Font
Name = "隶书"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
Left = 6240
TabIndex = 1
Top = 120
Width = 3285
End
End
Attribute VB_Name = "frmstuffinfoResult"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
On Error Resume Next
flag = 1
frmStuff.Show '添加员工信息
End Sub
Private Sub Command2_Click()
On Error Resume Next
On Error Resume Next
Dim SQL As String
If frmstuffinfoResult.rsGrid.Rows = 1 Then
MsgBox "目前没有员工信息,请先添加员工信息!", vbOKOnly + vbExclamation, "警告!"
flag = 1
frmStuff.Show
frmStuff.ZOrder 0
Else
SQL = "delete from StuffInfo where SID='" & Trim(frmstuffinfoResult.rsGrid.TextMatrix( _
frmstuffinfoResult.rsGrid.Row, 0)) & "'"
If MsgBox("真的要删除这条记录么?", vbOKCancel + vbExclamation, "提示!") = vbOK _
Then
TransactSQL (SQL)
MsgBox "员工信息记录已经删除!", vbOKOnly + vbExclamation, "警告!"
Unload Me
SQL = "select * from StuffInfo"
frmstuffinfoResult.createList (SQL)
frmstuffinfoResult.Show
End If
End If
End Sub
Private Sub Command3_Click()
On Error Resume Next
flag = 2
If frmstuffinfoResult.rsGrid.Rows > 1 Then
gSQL = "select * from StuffInfo where SID='" & Trim(frmstuffinfoResult.rsGrid.TextMatrix( _
frmstuffinfoResult.rsGrid.Row, 0)) & "'"
frmStuff.Show
frmStuff.ZOrder 0
Else
MsgBox "目前没有员工信息,请先添加员工信息!", vbOKOnly + vbExclamation, "警告!"
flag = 1
frmStuff.Show
End If
End Sub
Private Sub Command4_Click()
On Error Resume Next
frmsearchStuff.Show
End Sub
Private Sub Command5_Click()
On Error Resume Next
Unload Me
Exit Sub
End Sub
Private Sub Form_Load()
On Error Resume Next
Dim SQL As String
SQL = "select * from StuffInfo order by SID"
createList (SQL)
End Sub
Public Sub createList(SQL As String)
On Error Resume Next
On Error Resume Next
Dim rs As New ADODB.Recordset
Dim i As Integer
Dim rsGird As MSFlexGrid
With rsGrid '设置表头
.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) = "家庭住址"
.TextMatrix(0, 9) = "邮政编码"
.TextMatrix(0, 10) = "电话号码"
.TextMatrix(0, 11) = "Email"
.TextMatrix(0, 12) = "参加工作时间"
.TextMatrix(0, 13) = "进入公司时间"
.TextMatrix(0, 14) = "部门"
.TextMatrix(0, 15) = "起薪时间"
.TextMatrix(0, 16) = "职务"
.TextMatrix(0, 17) = "备注"
For i = 0 To 17 '设置所有表格对齐方式
.ColAlignment(i) = 4
Next i
For i = 0 To 11 '设置每列宽度
.ColWidth(i) = 1400
Next i
.ColWidth(8) = 3600
.ColWidth(11) = 3600
.ColWidth(12) = 2000
.ColWidth(13) = 2000
.ColWidth(14) = 1400
.ColWidth(15) = 2000
.ColWidth(16) = 1400
.ColWidth(17) = 3000
End With
Set rs = TransactSQL(SQL)
If rs.EOF = False Then
With rsGrid '显示信息内容
.Rows = 1
While Not rs.EOF
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 0) = rs(0)
.TextMatrix(.Rows - 1, 1) = rs(1)
.TextMatrix(.Rows - 1, 2) = rs(2)
.TextMatrix(.Rows - 1, 3) = rs(3)
.TextMatrix(.Rows - 1, 4) = rs(4)
.TextMatrix(.Rows - 1, 5) = rs(5)
.TextMatrix(.Rows - 1, 6) = rs(6)
.TextMatrix(.Rows - 1, 7) = rs(7)
.TextMatrix(.Rows - 1, 8) = rs(8)
.TextMatrix(.Rows - 1, 9) = rs(9)
.TextMatrix(.Rows - 1, 10) = rs(10)
.TextMatrix(.Rows - 1, 11) = rs(11)
.TextMatrix(.Rows - 1, 12) = rs(12)
.TextMatrix(.Rows - 1, 13) = rs(13)
.TextMatrix(.Rows - 1, 14) = rs(14)
.TextMatrix(.Rows - 1, 15) = rs(15)
.TextMatrix(.Rows - 1, 16) = rs(16)
.TextMatrix(.Rows - 1, 17) = rs(17)
rs.MoveNext
Wend
End With
rs.Close
End If
End Sub
Private Sub rsGrid_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error Resume Next
If Button = 2 And Shift = 0 Then
PopupMenu popmenu.popmenu
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -