📄 frmbmgl.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmBMGL
Caption = "部门管理"
ClientHeight = 4335
ClientLeft = 60
ClientTop = 345
ClientWidth = 7665
LinkTopic = "Form1"
LockControls = -1 'True
MDIChild = -1 'True
ScaleHeight = 4335
ScaleWidth = 7665
Begin VB.Frame Frame1
Height = 4215
Left = 0
TabIndex = 9
Top = 0
Width = 2055
Begin MSComctlLib.ListView LSTBM
Height = 3915
Left = 60
TabIndex = 10
Top = 180
Width = 1935
_ExtentX = 3413
_ExtentY = 6906
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
_Version = 393217
Icons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
End
Begin VB.Frame Frame2
Height = 3135
Left = 2100
TabIndex = 5
Top = 0
Width = 5475
Begin VB.TextBox BMMC
Height = 300
Left = 1380
TabIndex = 1
Top = 690
Width = 3255
End
Begin VB.TextBox BMRS
Height = 300
Left = 1380
TabIndex = 2
Top = 1380
Width = 3255
End
Begin VB.TextBox MEMO
Height = 300
Left = 1380
TabIndex = 3
Top = 2085
Width = 3255
End
Begin MSComctlLib.ImageList ImageList1
Left = 0
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 12
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBMGL.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBMGL.frx":1D0C
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBMGL.frx":2030
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBMGL.frx":2F0C
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBMGL.frx":3DE8
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBMGL.frx":410C
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBMGL.frx":4430
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBMGL.frx":4754
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBMGL.frx":4A78
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBMGL.frx":4D9C
Key = ""
EndProperty
BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBMGL.frx":50C0
Key = ""
EndProperty
BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBMGL.frx":53E4
Key = ""
EndProperty
EndProperty
End
Begin VB.Label Label2
Caption = "部门名称"
Height = 375
Left = 240
TabIndex = 8
Top = 750
Width = 1575
End
Begin VB.Label Label3
Caption = "部门人数"
Height = 375
Left = 240
TabIndex = 7
Top = 1440
Width = 1575
End
Begin VB.Label Label4
Caption = "备 注"
Height = 375
Left = 240
TabIndex = 6
Top = 2145
Width = 1575
End
End
Begin VB.Frame Frame3
Height = 1095
Left = 2100
TabIndex = 0
Top = 3120
Width = 5475
Begin VB.CommandButton Command1
Caption = "新增"
Height = 435
Left = 495
TabIndex = 4
Top = 375
Width = 1065
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 435
Left = 2695
TabIndex = 13
Top = 375
Width = 1065
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 435
Left = 3795
TabIndex = 12
Top = 375
Width = 1065
End
Begin VB.CommandButton Command4
Caption = "修改"
Height = 435
Left = 1595
TabIndex = 11
Top = 375
Width = 1065
End
End
End
Attribute VB_Name = "frmBMGL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim id As Long
Private Sub BMMC_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{Tab}"
End Sub
Private Sub BMRS_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{Tab}"
End Sub
Private Sub Command1_Click()
If Trim(BMMC) = "" Or Trim(BMRS) = "" Then
MsgBox "部门名称或部门人数不能为空!!", vbInformation, "系统提示"
Exit Sub
End If
Dim strsql As String
Dim rs As New ADODB.Recordset
Set rs = New ADODB.Recordset
strsql = "select * from bmgl where bmmc='" & Trim(BMMC) & "'"
rs.Open strsql, gCnn, adOpenStatic, adLockReadOnly
If Not rs.EOF Then
MsgBox "存在相同的部门名称,不能添加!!", vbInformation, "系统提示"
Exit Sub
End If
strsql = "insert into bmgl(bmmc,bmrs,memo)values('" & Trim(BMMC) & "','" & Trim(BMRS) & "','" & Trim(MEMO) & "')"
gCnn.Execute strsql
BMMC = ""
BMRS = ""
MEMO = ""
Call Form_Load
Command4.Enabled = False
Command2.Enabled = False
End Sub
Private Sub Command2_Click()
gCnn.Execute "delete from bmgl where id=" & id
BMMC = ""
BMRS = ""
MEMO = ""
Call Form_Load
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
Dim strsql As String
strsql = "update bmgl set bmmc='" & BMMC & "',bmrs='" & BMRS & "',memo='" & MEMO & "' where id=" & id
gCnn.Execute strsql
BMMC = ""
BMRS = ""
MEMO = ""
Command4.Enabled = False
Call Form_Load
End Sub
Private Sub Form_Load()
If Me.WindowState = 0 Then Me.Move 0, 0, 7860, 4860
Dim msg As String
Dim rs As New ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select id,bmmc as 部门名称 from BMGL order by id", gCnn, adOpenStatic, adLockReadOnly
msg = ShowListView(LSTBM, rs, False, "0,2000")
Command4.Enabled = False
Command2.Enabled = False
End Sub
Private Sub LSTBM_ItemClick(ByVal Item As MSComctlLib.ListItem)
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select * from bmgl where id=" & Item, gCnn, adOpenStatic, adLockReadOnly
If Not rs.EOF Then
BMMC = rs("bmmc")
BMRS = rs("bmrs")
MEMO = rs("memo")
Command4.Enabled = True
Command2.Enabled = True
id = Item
End If
End Sub
Private Sub MEMO_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{Tab}"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -