frmuserid.frm
来自「人事管理系统的一个比较不错的VB软件 有管理系统的功能」· FRM 代码 · 共 230 行
FRM
230 行
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmUserId
BorderStyle = 1 'Fixed Single
Caption = "用户设置"
ClientHeight = 4065
ClientLeft = 45
ClientTop = 330
ClientWidth = 4725
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4065
ScaleWidth = 4725
StartUpPosition = 3 '窗口缺省
Begin MSComctlLib.ImageList ImageList1
Left = 1560
Top = 2520
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 38
ImageHeight = 38
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmUserId.frx":0000
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ListView LViewUser
Height = 3015
Left = 120
TabIndex = 4
Top = 960
Width = 4455
_ExtentX = 7858
_ExtentY = 5318
View = 3
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
Icons = "ImageList1"
SmallIcons = "ImageList1"
ColHdrIcons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
Begin VB.CommandButton cmdDelete
Caption = "删除"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 400
Left = 3480
TabIndex = 3
Top = 240
Width = 1000
End
Begin VB.CommandButton cmdSave
Caption = "保存"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 400
Left = 2280
TabIndex = 2
Top = 240
Width = 1000
End
Begin VB.TextBox txtId
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 720
MaxLength = 6
TabIndex = 1
Top = 240
Width = 1335
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "用户"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 120
TabIndex = 0
Top = 360
Width = 450
End
End
Attribute VB_Name = "frmUserId"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public mrc As ADODB.Recordset
Dim txtSql As String
Private Sub cmdDelete_Click()
If Not check_UserId Then
Exit Sub
End If
txtSql = "delete from limit where Id='" & txtId.Text & "'"
Set mrc = Nothing
Set mrc = ExecuteSQL(txtSql)
Call ShowList
txtId.Text = ""
End Sub
Private Sub cmdSave_Click()
If Not check_UserId Then
Exit Sub
End If
txtSql = "select * from limit where Id='" & txtId.Text & "' and Program ='hrd401'"
Set mrc = Nothing
Set mrc = ExecuteSQL(txtSql)
If mrc.EOF Then
txtSql = "select * from limit"
Set mrc = Nothing
Set mrc = ExecuteSQL(txtSql)
mrc.AddNew
mrc.Fields(0) = txtId.Text
mrc.Fields(1) = "hrd401"
mrc.Fields(2) = "2" '维护权限
mrc.Update
End If
Call ShowList
txtId.Text = ""
End Sub
Private Sub Form_Load()
Dim FlagEnabled As Boolean
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
FlagEnabled = CheckProgramLimit("hrd402")
cmdSave.Enabled = FlagEnabled
cmdDelete.Enabled = FlagEnabled
Call Init
Call ShowList
End Sub
Private Sub Init()
Dim TvHead As ColumnHeader
Set TvHead = LViewUser.ColumnHeaders.Add(, "h01", "序号", 0)
Set TvHead = LViewUser.ColumnHeaders.Add(, "h02", "用户", 3000)
End Sub
Private Sub ShowList()
Dim i As Integer
Dim LvDate As ListItem
LViewUser.ListItems.Clear
txtSql = "select * from limit where Program='hrd401'"
Set mrc = Nothing
Set mrc = ExecuteSQL(txtSql)
i = 1
Do While Not mrc.EOF
Set LvData = LViewUser.ListItems.Add(, "d" & i, i, 1, 1)
LvData.SubItems(1) = mrc.Fields(0).Value
i = i + 1
mrc.MoveNext
Loop
mrc.Close
End Sub
Private Function check_UserId() As Boolean
check_UserId = True
If txtId.Text = "" Then
MsgBox "输入的数据不正确", vbCritical + vbOKOnly, "错误提示: "
txtId.SetFocus
check_UserId = False
End If
End Function
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?