📄 frmsysset.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form frmSysSet
BorderStyle = 1 'Fixed Single
Caption = "系统设置"
ClientHeight = 4920
ClientLeft = 3750
ClientTop = 1995
ClientWidth = 8295
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmSysSet.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4920
ScaleWidth = 8295
Begin VB.PictureBox Picture1
Appearance = 0 'Flat
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 4035
Left = 60
ScaleHeight = 4005
ScaleWidth = 8145
TabIndex = 2
Top = 60
Width = 8175
Begin VB.OptionButton opt2
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "否"
ForeColor = &H80000008&
Height = 255
Left = 3180
TabIndex = 20
Top = 1230
Width = 585
End
Begin VB.OptionButton opt1
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "是"
ForeColor = &H80000008&
Height = 255
Left = 2280
TabIndex = 19
Top = 1230
Width = 585
End
Begin VB.TextBox txtEnd
Appearance = 0 'Flat
Height = 315
Left = 5160
TabIndex = 17
Top = 630
Width = 2775
End
Begin VB.TextBox txtHat
Appearance = 0 'Flat
Height = 315
Left = 1230
TabIndex = 16
Top = 660
Width = 2775
End
Begin VB.TextBox txtCap
Appearance = 0 'Flat
Height = 315
Left = 1230
TabIndex = 9
Top = 210
Width = 6705
End
Begin VB.TextBox txtUserName
Appearance = 0 'Flat
Height = 345
Left = 6150
TabIndex = 7
Top = 1800
Width = 1755
End
Begin VB.TextBox txtPassWord
Appearance = 0 'Flat
Height = 345
Left = 6150
TabIndex = 6
Top = 2340
Width = 1755
End
Begin VB.ComboBox cobPurview
Appearance = 0 'Flat
Height = 330
Left = 6150
Style = 2 'Dropdown List
TabIndex = 5
Top = 2850
Width = 1785
End
Begin Manage.xpcmdbutton cmdDel
Height = 375
Left = 6870
TabIndex = 3
Top = 3420
Width = 975
_ExtentX = 1720
_ExtentY = 661
Caption = "删 除"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Manage.xpcmdbutton cmdAdd
Height = 375
Left = 5460
TabIndex = 4
Top = 3420
Width = 975
_ExtentX = 1720
_ExtentY = 661
Caption = "添 加"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSFlexGridLib.MSFlexGrid Grid
Height = 2205
Left = 120
TabIndex = 8
Top = 1680
Width = 4755
_ExtentX = 8387
_ExtentY = 3889
_Version = 393216
Cols = 3
FixedCols = 0
SelectionMode = 1
Appearance = 0
FormatString = " 用 户 名|^ 密 码|^ 权 限"
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "是否打印销售票据:"
Height = 210
Index = 3
Left = 210
TabIndex = 18
Top = 1260
Width = 1890
End
Begin VB.Line Line1
X1 = 150
X2 = 7950
Y1 = 1110
Y2 = 1110
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "票据尾:"
Height = 210
Index = 1
Left = 4320
TabIndex = 15
Top = 720
Width = 840
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "票据头:"
Height = 210
Index = 0
Left = 390
TabIndex = 14
Top = 720
Width = 840
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "系统标题:"
Height = 210
Index = 2
Left = 180
TabIndex = 13
Top = 270
Width = 1050
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "用户名"
Height = 255
Index = 0
Left = 5220
TabIndex = 12
Top = 1890
Width = 765
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密 码"
Height = 255
Index = 1
Left = 5220
TabIndex = 11
Top = 2400
Width = 765
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "权 限"
Height = 255
Index = 2
Left = 5220
TabIndex = 10
Top = 2880
Width = 765
End
End
Begin Manage.xpcmdbutton cmdCancel
Height = 465
Left = 5850
TabIndex = 1
Top = 4320
Width = 1515
_ExtentX = 2672
_ExtentY = 820
Caption = "取 消"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Manage.xpcmdbutton cmdSave
Height = 465
Left = 3540
TabIndex = 0
Top = 4320
Width = 1515
_ExtentX = 2672
_ExtentY = 820
Caption = "保 存"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
End
Attribute VB_Name = "frmSysSet"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdAdd_Click()
If cmdAdd.Caption = "添 加" Then
txtUserName.Enabled = True
txtPassWord.Enabled = True
cobPurview.Enabled = True
txtUserName.Text = ""
txtPassWord.Text = ""
cobPurview.ListIndex = -1
cmdAdd.Caption = "保 存"
cmdDel.Caption = "取 消"
Grid.Enabled = False
Else
If txtUserName.Text = "" Or cobPurview.ListIndex = -1 Then MsgBox "请正确设置用户信息!", 64: Exit Sub
Dim Cmd As ADODB.Command
Dim SQL As String
Dim I As Integer
For I = 1 To Grid.Rows - 1
If txtUserName.Text = Grid.TextMatrix(I, 0) Then MsgBox "您所要添加的用户名与现有用户冲突!", 16: Exit Sub
Next I
Set Cmd = New ADODB.Command
Cmd.ActiveConnection = Conn
SQL = "insert into [user] values ('" & txtUserName.Text & "','" & txtPassWord.Text & "','" & cobPurview.Text & "')"
Cmd.CommandText = SQL
Cmd.CommandType = adCmdText
Cmd.Execute
Set Cmd = Nothing
Grid.Rows = Grid.Rows + 1
Grid.TextMatrix(Grid.Rows - 1, 0) = txtUserName.Text
Grid.TextMatrix(Grid.Rows - 1, 1) = txtPassWord.Text
Grid.TextMatrix(Grid.Rows - 1, 2) = cobPurview.Text
cmdDel_Click
End If
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdDel_Click()
If cmdDel.Caption = "删 除" Then
If Grid.TextMatrix(Grid.RowSel, 0) = UserName Then MsgBox "不能删除当前登陆用户!", 64: Exit Sub
Dim Cmd As ADODB.Command
Dim SQL As String
If MsgBox("您真的要删除这一用户吗?一旦删除无法恢复!(是/否)", vbYesNo + 32, "系统警告") = vbNo Then Exit Sub
Set Cmd = New ADODB.Command
Cmd.ActiveConnection = Conn
SQL = "delete from [user] where username='" & Grid.TextMatrix(Grid.RowSel, 0) & "'"
Cmd.CommandText = SQL
Cmd.CommandType = adCmdText
Cmd.Execute
Grid.RemoveItem Grid.RowSel
txtUserName.Text = ""
txtPassWord.Text = ""
cobPurview.ListIndex = -1
Else
cmdAdd.Caption = "添 加"
cmdDel.Caption = "删 除"
txtUserName.Enabled = False
txtPassWord.Enabled = False
cobPurview.Enabled = False
Grid.Enabled = True
End If
End Sub
Private Sub cmdSave_Click()
Dim Cmd As ADODB.Command
Dim SQL As String
Set Cmd = New ADODB.Command
Cmd.ActiveConnection = Conn
SQL = "update sysset set syscaption='" & txtCap.Text & "',printhat='" _
& txtHat.Text & "',printend='" & txtEnd.Text & "',isprint=" & IIf(opt1.Value = True, 1, 0)
Cmd.CommandText = SQL
Cmd.CommandType = adCmdText
Cmd.Execute
Set Cmd = Nothing
frmMain.Caption = txtCap.Text
Unload Me
End Sub
Private Sub Form_Load()
Dim Rst As ADODB.Recordset
Dim I As Integer
cobPurview.AddItem "系统管理员"
cobPurview.AddItem "普通用户"
txtUserName.Enabled = False
txtPassWord.Enabled = False
cobPurview.Enabled = False
Set Rst = New ADODB.Recordset
Rst.CursorLocation = adUseClient
Rst.Open "sysset", Conn, adOpenDynamic, adLockReadOnly, adCmdTable
txtCap.Text = Rst.Fields(0)
txtHat.Text = Rst.Fields(1)
txtEnd.Text = Rst.Fields(2)
If Rst.Fields(3) = 0 Then opt2.Value = True Else opt1.Value = True
Rst.Close
FillGrid " 用 户 名|^ 密 码 |^ 权 限 ", "select * from [user]", Grid, 3
End Sub
Private Sub Grid_Click()
txtUserName.Text = Grid.TextMatrix(Grid.RowSel, 0)
txtPassWord.Text = Grid.TextMatrix(Grid.RowSel, 1)
cobPurview.Text = Grid.TextMatrix(Grid.RowSel, 2)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -