📄 user.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form user
BackColor = &H0080C0FF&
Caption = "用户管理"
ClientHeight = 3945
ClientLeft = 3735
ClientTop = 1980
ClientWidth = 5205
Icon = "user.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3945
ScaleWidth = 5205
Begin VB.Frame Frame2
BackColor = &H0080C0FF&
Caption = "添加新用户"
Height = 2535
Left = 2520
TabIndex = 1
Top = 1080
Width = 2535
Begin VB.TextBox txtmc
Appearance = 0 'Flat
ForeColor = &H00FF0000&
Height = 375
IMEMode = 3 'DISABLE
Left = 1080
PasswordChar = "*"
TabIndex = 5
Top = 1200
Width = 1215
End
Begin VB.TextBox txtbh
Appearance = 0 'Flat
ForeColor = &H00FF0000&
Height = 375
Left = 1080
TabIndex = 4
Top = 480
Width = 1215
End
Begin VB.CommandButton CmdNO
Caption = "取消"
Height = 375
Left = 1680
Picture = "user.frx":030A
Style = 1 'Graphical
TabIndex = 3
Top = 2040
Width = 735
End
Begin VB.CommandButton CmdOK
Caption = "确定"
Default = -1 'True
Height = 375
Left = 120
Picture = "user.frx":0614
Style = 1 'Graphical
TabIndex = 2
Top = 2040
Width = 735
End
Begin VB.Label lb2
BackStyle = 0 'Transparent
Caption = "密码:"
ForeColor = &H00FF0000&
Height = 375
Left = 480
TabIndex = 7
Top = 1200
Width = 615
End
Begin VB.Label lb1
BackStyle = 0 'Transparent
Caption = "用户名称:"
ForeColor = &H00FF0000&
Height = 255
Left = 120
TabIndex = 6
Top = 480
Width = 975
End
End
Begin VB.Frame Frame1
BackColor = &H0080C0FF&
Caption = "用户成员"
Height = 2535
Left = 120
TabIndex = 0
Top = 1080
Width = 2295
Begin VB.ListBox lstname
BackColor = &H00FFFFFF&
ForeColor = &H00FF0000&
Height = 2040
Left = 120
TabIndex = 10
Top = 360
Width = 2055
End
End
Begin MSComctlLib.ImageList ImList
Left = 3360
Top = 600
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 14
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":091E
Key = "Print"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":0A32
Key = "Priview"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":0F76
Key = "Add"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":108A
Key = "Del"
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":119E
Key = "Edit"
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":12B2
Key = "Save"
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":13C6
Key = "Undo"
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":14DA
Key = "Exit"
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":15EE
Key = "First"
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":1B42
Key = "Previous"
EndProperty
BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":1C56
Key = "Next"
EndProperty
BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":1D6A
Key = "Last"
EndProperty
BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":22BE
Key = "Inline"
EndProperty
BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "user.frx":2612
Key = "Delline"
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Tlbar
Align = 1 'Align Top
Height = 555
Left = 0
TabIndex = 8
Top = 0
Width = 5205
_ExtentX = 9181
_ExtentY = 979
ButtonWidth = 609
ButtonHeight = 926
Appearance = 1
Style = 1
ImageList = "ImList"
_Version = 393216
End
Begin VB.Label x
BackStyle = 0 'Transparent
Caption = "已启用"
ForeColor = &H000000FF&
Height = 255
Left = 120
TabIndex = 9
Top = 3720
Visible = 0 'False
Width = 1575
End
End
Attribute VB_Name = "user"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
'Download by http://www.codefans.net
Attribute VB_Exposed = False
Public dbs As Database
Public rec As Recordset
Sub save() '保存
If txtbh.Text = "" Then Exit Sub
filename = App.Path & "\股票.mdb"
Set dbs = OpenDatabase(filename)
Set rec = dbs.OpenRecordset("操作员")
rec.AddNew
rec.Fields(0) = txtbh.Text
rec.Fields(1) = txtmc.Text
rec.Update
lstname.AddItem txtbh.Text
txtbh.Text = ""
txtmc.Text = ""
txtbh.SetFocus
End Sub
Private Sub CmdNO_Click()
Unload Me
End Sub
Private Sub CmdOK_Click()
save
End Sub
Private Sub Form_Load()
CmdOK.Enabled = False
txtbh.Enabled = False
txtmc.Enabled = False
Tlbar.Buttons.add 1, "Add", "增加", , "Add"
Tlbar.Buttons.add 2, "Del", "删除", , "Del"
Tlbar.Buttons.add 3, , , tbrSeparator
Tlbar.Buttons.add 4, "Save", "保存", , "Save"
Tlbar.Buttons.add 5, "Undo", "撤消", , "Undo"
Tlbar.Buttons.add 6, , , tbrSeparator
Tlbar.Buttons.add 7, "Exit", "退出", , "Exit"
Dim mNode, mnode1 As Node
Dim i As Integer
Dim sql As String
filename = App.Path & "\股票.mdb"
Set dbs = OpenDatabase(filename)
Set rec = dbs.OpenRecordset("操作员")
If rec.RecordCount = 0 Then Exit Sub
Do While Not rec.EOF
lstname.AddItem rec.Fields(0)
rec.MoveNext
Loop
Tlbar.Buttons(2).Enabled = False
Tlbar.Buttons(3).Enabled = False
Tlbar.Buttons(4).Enabled = False
End Sub
Private Sub Tlbar_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "Add" '添加
Changed = False
Tlbar.Buttons(5).Enabled = False
txtbh.Enabled = True
txtmc.Enabled = True
txtbh.Text = ""
txtmc.Text = ""
txtbh.SetFocus
CmdOK.Enabled = False
Case "Undo"
txtbh.Text = ""
txtmc.Text = ""
Tlbar.Buttons(2).Enabled = False
Tlbar.Buttons(3).Enabled = False
Tlbar.Buttons(5).Enabled = False
Case "Save" '保存
Tlbar.Buttons(2).Enabled = False
save
Case "Del" '删除
r = MsgBox("是否确认删除?(Y/N)", 1 + 64, "个人股票管理")
If r = 1 Then
dbs.Execute "DELETE * FROM " _
& "[操作员] WHERE 姓名 ='" & lstname.Text & "'"
txtbh.Text = ""
lstname.RemoveItem lstname.ListIndex
txtmc.Text = ""
End If
Case "Exit" '关闭
Unload Me
End Select
End Sub
Private Sub txtmc_Change()
CmdOK.Enabled = True
Tlbar.Buttons(4).Enabled = True
End Sub
Private Sub lstname_Click()
If lstname.Text = "超级用户" Then
Tlbar.Buttons(2).Enabled = False
Else
Tlbar.Buttons(2).Enabled = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -