📄 frm_zwxx.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Frm_Smxx
BorderStyle = 1 'Fixed Single
Caption = "职务信息设置"
ClientHeight = 3390
ClientLeft = 45
ClientTop = 330
ClientWidth = 6915
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 3390
ScaleWidth = 6915
StartUpPosition = 3 '窗口缺省
Begin MSDataGridLib.DataGrid Dgr_bmzl
Bindings = "Frm_Smxx.frx":0000
Height = 2395
Left = 4305
TabIndex = 8
Top = 900
Width = 2535
_ExtentX = 4471
_ExtentY = 4233
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 135
Top = 3570
Width = 1815
_ExtentX = 3201
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSComctlLib.ImageList ImageList1
Left = 435
Top = 2520
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 26
ImageHeight = 26
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 7
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Smxx.frx":0015
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Smxx.frx":166F
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Smxx.frx":2CC9
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Smxx.frx":4323
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Smxx.frx":597D
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Smxx.frx":6FD7
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Smxx.frx":8631
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Tbr_xxcz
Align = 1 'Align Top
Height = 765
Left = 0
TabIndex = 1
Top = 0
Width = 6915
_ExtentX = 12197
_ExtentY = 1349
ButtonWidth = 1455
ButtonHeight = 1191
Appearance = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 7
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = " 添加"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = " 删除 "
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "保存"
ImageIndex = 4
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "取消"
ImageIndex = 5
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "查询"
ImageIndex = 6
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
ImageIndex = 7
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Caption = "职务基本信息"
Height = 2490
Left = 105
TabIndex = 0
Top = 810
Width = 4125
Begin VB.TextBox Text1
Height = 1290
Index = 2
Left = 1110
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 6
Top = 1020
Width = 2775
End
Begin VB.TextBox Text1
Height = 300
Index = 1
Left = 1110
TabIndex = 5
Top = 645
Width = 2775
End
Begin VB.TextBox Text1
Height = 300
Index = 0
Left = 1110
TabIndex = 3
Top = 240
Width = 2775
End
Begin VB.Label Label8
Caption = "职务说明"
Height = 285
Left = 120
TabIndex = 7
Top = 1065
Width = 765
End
Begin VB.Label Label1
Caption = "职务名称"
Height = 255
Index = 1
Left = 120
TabIndex = 4
Top = 705
Width = 855
End
Begin VB.Label Label1
Caption = "编号"
Height = 255
Index = 0
Left = 120
TabIndex = 2
Top = 345
Width = 855
End
End
End
Attribute VB_Name = "Frm_Smxx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim c
Private Sub Dgr_bmzl_Click()
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
Text1(0).Text = Adodc1.Recordset.Fields("bmxx_id")
Text1(1).Text = Adodc1.Recordset.Fields("bmxx_mc")
Text1(2).Text = Adodc1.Recordset.Fields("bmxx_bz")
End If
For i = 1 To 2
Text1(i).Locked = False
Next i
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Call LoadFile
For i = 0 To 2
Text1(i).Locked = True
Next i
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from tb_bmxx order by bmxx_id"
Adodc1.Refresh
Call DBGCon
Call Tbr_cortrol(Tbr_xxcz, True)
End Sub
Private Sub Tbr_xxcz_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 1
Call Tbr_cortrol(Tbr_xxcz, False)
For i = 1 To 2
Text1(i).Locked = False
Text1(i).Text = ""
Text1(0).SetFocus
Next i
AdoRs.Open "select * from tb_bmxx order by bmxx_id", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
AdoRs.MoveLast
StrNum = AdoRs.Fields("bmxx_id")
Call Con_idNum '调用位数转换函数
Text1(0).Text = StrIn
Else
Text1(0).Text = "001"
End If
AdoRs.Close
Case 2 '删除信息
Call Deletes
Case 3 '修改信息
Call Edits
Case 4 '保存信息
Call Saves
Case 5
Call Tbr_cortrol(Tbr_xxcz, True)
For i = 1 To 2
Text1(i).Text = ""
Text1(1).SetFocus
Next i
Case 6
Frm_Cx.Show 1
Case 7
Unload Me
End Select
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
On Error Resume Next
If KeyCode = 13 Then
If Index >= 0 Then Text1(Index + 1).SetFocus
If Index = 2 Then
Call Saves
End If
End If
If Index >= 0 And KeyCode = 40 Then Text1(Index + 1).SetFocus
If Index <= 2 And KeyCode = 38 Then Text1(Index - 1).SetFocus
End Sub
Private Sub Saves() '保存信息的事件过程
If Text1(1).Text = "" Then
MsgBox "部门名称不能为空", 48, "提示信息"
Else
AdoRs.Open "select * from tb_bmxx where bmxx_mc='" + Text1(1).Text + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
MsgBox "该部门信息已经存在", 48, "提示信息"
AdoRs.Close
Else
AdoRs.Close
c = MsgBox("确认保存信息吗", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("insert into tb_bmxx values('" & Text1(0) & "','" & Text1(1) & "','" & Text1(2) & "')")
MsgBox "数据保存成功", 64, "提示信息"
Else
End If
Adodc1.RecordSource = "select * from tb_bmxx order by bmxx_id"
Adodc1.Refresh
Call DBGCon
End If
Call Tbr_cortrol(Tbr_xxcz, True)
End If
End Sub
Private Sub Edits() '修改信息的事件过程
c = MsgBox("确认修改信息吗", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("UPDATE tb_bmxx SET bmxx_id='" + Text1(0) + "',bmxx_mc='" + Text1(1) + "',bmxx_bz='" + Text1(2) + "' where bmxx_id='" + Text1(0).Text + "'")
MsgBox "数据修改成功", 64, "提示信息"
Adodc1.Refresh
Call DBGCon
Else
' AdoRs.Close
End If
End Sub
Private Sub LoadFile()
AdoRs.Open "select * from tb_bmxx", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Text1(0).Text = AdoRs.Fields("bmxx_id")
Text1(1).Text = AdoRs.Fields("bmxx_mc")
Text1(2).Text = AdoRs.Fields("bmxx_bz")
End If
AdoRs.Close
End Sub
Private Sub LTbrControl()
Tbr_Gsxx.Buttons(1).Enabled = True
Tbr_Gsxx.Buttons(2).Enabled = False
Tbr_Gsxx.Buttons(3).Enabled = True
End Sub
Private Sub CTbrControl() '单击编辑按钮
Tbr_Gsxx.Buttons(1).Enabled = False
Tbr_Gsxx.Buttons(2).Enabled = True
Tbr_Gsxx.Buttons(3).Enabled = True
End Sub
Private Sub Deletes() '删除信息
c = MsgBox("确认删除该信息吗", 17, "提示信息")
If c = vbOK Then
On Error Resume Next
Adodc1.Recordset.Delete
End If
For i = 1 To 2
Text1(i).Text = ""
Next i
End Sub
Private Sub DBGCon()
Dgr_bmzl.Columns(0).Caption = "部门编号"
Dgr_bmzl.Columns(1).Caption = "部门名称"
Dgr_bmzl.Columns(2).Visible = False
Dgr_bmzl.Columns(0).Width = 800
Dgr_bmzl.Columns(1).Width = 1380
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -