📄 复件 frmuser.frm
字号:
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 90
TabIndex = 13
Top = 915
Width = 1485
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "登陆号码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 90
TabIndex = 12
Top = 420
Width = 1485
End
End
Begin VB.Frame Frame1
Appearance = 0 'Flat
ForeColor = &H80000008&
Height = 5805
Left = 60
TabIndex = 9
Top = 15
Width = 2460
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 5580
Left = 60
TabIndex = 10
Top = 150
Width = 2340
_ExtentX = 4128
_ExtentY = 9843
_Version = 393216
FixedCols = 0
Appearance = 0
End
End
Begin VB.Frame Frame3
Appearance = 0 'Flat
ForeColor = &H80000008&
Height = 1020
Left = 2535
TabIndex = 19
Top = 4800
Width = 6240
Begin VB.CommandButton Command4
Caption = "刷 新(&F)"
Height = 420
Left = 1425
TabIndex = 21
Top = 330
Width = 1125
End
Begin VB.CommandButton Command3
Caption = "退 出(&E)"
Height = 420
Left = 4815
TabIndex = 8
Top = 330
Width = 1125
End
Begin VB.CommandButton Command2
Caption = "删 除(&D)"
Height = 420
Left = 3684
TabIndex = 20
Top = 330
Width = 1125
End
Begin VB.CommandButton Command1
Caption = "添 加(&S)"
Height = 420
Left = 2550
TabIndex = 7
Top = 330
Width = 1125
End
End
End
Attribute VB_Name = "frmUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strHead As String
Dim strWid As String
Private Sub Command1_Click()
Dim strYYY As String
Dim rs As New ADODB.Recordset
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "数据错误!", vbInformation, "系统提示"
Exit Sub
End If
If Text3.Text <> Text4.Text Then
MsgBox "密码数据错误!", vbInformation, "系统提示"
Exit Sub
End If
If rs.State = 1 Then rs.Close
strYYY = "select * from T_用户表 where 登陆号码='" & Text1.Text & "'"
rs.Open strYYY, gCnn, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
' strYYY = "update T_用户表 set 姓名='" & Text2.Text & "',密码='" & Text3.Text & "',状态='" & Combo1.Text & "',备注='" & Text5.Text & "',权限='' where 登陆号码='" & Text1.Text & "'"
MsgBox "登陆号码重复,该用户已存在!", vbInformation, "系统提示"
Exit Sub
Else
strYYY = "insert into T_用户表(登陆号码,姓名,密码,状态,加入日期,备注,权限) values('" & Text1 & "','" & Text2 & "','" & Text3 & "','" & Combo1 & "','" & Format(DTPicker1, "yyyy-mm-dd") & "','" & Text5 & "','')"
End If
gCnn.Execute strYYY
If rs.State = 1 Then rs.Close
MsgBox "保存成功!", vbInformation, "系统提示"
Call Form_Load
' gtxtclear
End Sub
Private Sub Command2_Click()
Dim strYYY As String
Dim rs As New ADODB.Recordset
If Text1.Text = "1001" Then
MsgBox "此超级用户不可删除!", vbInformation, "系统提示"
Exit Sub
End If
If Text1.Text = "" Then
MsgBox "数据错误!", vbInformation, "系统提示"
Exit Sub
End If
If rs.State = 1 Then rs.Close
strYYY = "select * from T_用户表 where 登陆号码='" & Text1.Text & "'"
rs.Open strYYY, gCnn, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
strYYY = "delete T_用户表 where 登陆号码='" & Text1.Text & "'"
End If
gCnn.Execute strYYY
'删除权限表内的数据
strYYY = "delete VstMenu where guser='" & Text1.Text & "'"
gCnn.Execute strYYY
If rs.State = 1 Then rs.Close
MsgBox "删除成功!", vbInformation, "系统提示"
Call Form_Load
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
Call Form_Load
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{tab}"
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{tab}"
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{tab}"
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{tab}"
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{tab}"
End Sub
Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{tab}"
End Sub
Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{tab}"
End Sub
Private Sub Form_Load()
' T_用户表 id,登陆号码,姓名,密码,状态,加入日期,备注,最后登陆日期
' Dim rs As New ADODB.Recordset
' If Me.WindowState = 0 Then Me.Move 0, 0
' Call ShowHead
'
' If rs.State = 1 Then rs.Close
' MSFlexGrid1.Rows = 1
' gSQL = "select 登陆号码,姓名,密码,状态,加入日期,备注 from T_用户表"
' rs.Open gSQL, gCnn, adOpenStatic, adLockReadOnly
' If rs.RecordCount >= 1 Then
' rs.MoveFirst
'
' Do While Not rs.EOF
'
' MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
' MSFlexGrid1.Row = MSFlexGrid1.Rows - 1
' MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0) = rs.Fields(0).Value
' MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1) = rs.Fields(1).Value
' MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2) = rs.Fields(2).Value
' MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 3) = rs.Fields(3).Value
' MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 4) = rs.Fields(4).Value
'
' MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 5) = rs.Fields(5).Value
' rs.MoveNext
' Loop
'
' End If
'
' If rs.State = 1 Then rs.Close
'
'
' gtxtclear
End Sub
Private Sub ShowHead()
'MSFlexGrid1设置
strHead = "登陆号码,姓名,密码,状态,加入日期,备注"
strWid = "800,1200,0,0,0,0"
FillGridHead MSFlexGrid1, strHead, strWid
End Sub
Private Sub MSFlexGrid1_Click()
If MSFlexGrid1.Rows = 1 Then Exit Sub
If MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1) = "" Then Exit Sub
Text1.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)
Text1.Enabled = False
Text2.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1)
Text3.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2)
Text4.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2)
Text5.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 5)
Combo1.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 3)
DTPicker1 = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 4)
End Sub
Public Sub gtxtclear()
Text1.Enabled = True
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
DTPicker1 = Date
Combo1 = "正常使用"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -