📄 frmgroup.frm
字号:
VERSION 5.00
Begin VB.Form frmGroup
BorderStyle = 1 'Fixed Single
Caption = "用户组"
ClientHeight = 4770
ClientLeft = 45
ClientTop = 330
ClientWidth = 7395
Icon = "frmGroup.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4770
ScaleWidth = 7395
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton CmdDel
Caption = "删除 ->"
Height = 495
Left = 2880
TabIndex = 1
Top = 3240
Width = 1215
End
Begin VB.CommandButton CmdAdd
Caption = "<- 添加"
Height = 495
Left = 2880
TabIndex = 0
Top = 2640
Width = 1215
End
Begin VB.ListBox List2
Height = 2400
Left = 4200
MultiSelect = 2 'Extended
TabIndex = 7
Top = 2040
Width = 2895
End
Begin VB.ListBox List1
Height = 2400
Left = 240
MultiSelect = 2 'Extended
TabIndex = 6
Top = 2040
Width = 2535
End
Begin VB.CommandButton CmdCancel
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5640
TabIndex = 3
Top = 960
Width = 1455
End
Begin VB.CommandButton CmdOk
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5640
TabIndex = 2
Top = 360
Width = 1455
End
Begin VB.Label Label4
Caption = "不隶属于:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4200
TabIndex = 9
Top = 1800
Width = 1455
End
Begin VB.Label Label3
Caption = "隶属于:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 8
Top = 1800
Width = 1815
End
Begin VB.Label lblName
Height = 375
Left = 1440
TabIndex = 5
Top = 480
Width = 1575
End
Begin VB.Label Label1
Caption = "用户:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 4
Top = 480
Width = 615
End
End
Attribute VB_Name = "frmGroup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub CmdAdd_Click()
Dim i As Integer
Dim flag As Boolean
flag = False
If List2.ListCount < 1 Then Exit Sub
If List2.ListIndex >= 0 Then
Do Until flag = True
If List2.ListCount < 1 Then Exit Sub
For i = 0 To List2.ListCount - 1
If List2.Selected(i) = True Then
flag = False
Exit For
Else
flag = True
End If
Next
If flag = False Then
List2.ListIndex = i
List1.AddItem List2.Text
List2.RemoveItem i
End If
Loop
End If
End Sub
Private Sub CmdCancel_Click()
Unload Me
End Sub
Private Sub CmdDel_Click()
Dim i As Integer
Dim flag As Boolean
flag = False
If List1.ListCount < 1 Then Exit Sub
If List1.ListIndex >= 0 Then
Do Until flag = True
If List1.ListCount < 1 Then Exit Sub
For i = 0 To List1.ListCount - 1
If List1.Selected(i) = True Then
flag = False
Exit For
Else
flag = True
End If
Next
If flag = False Then
List1.ListIndex = i
List2.AddItem List1.Text
List1.RemoveItem i
End If
Loop
End If
End Sub
Private Sub CmdOk_Click()
Dim str As String
Dim i As Integer
str = "delete from groupuser where groupname!='' and username='" & Trim(lblName.Caption) & "'"
Pubsaconn.Execute str, 64
If List1.ListCount > 0 Then
For i = 0 To List1.ListCount - 1
List1.ListIndex = i
str = "insert into groupuser (groupname,username,deparment_C,username_c,password,phoneno ,arrangeorder,tagpsw,field1) values ("
str = str & "'" & Trim(List1.Text) & "','" & Trim(lblName.Caption)
str = str & "','" & Trim(frmUser.Text1.Text) & "','" & Trim(frmUser.Text2.Text)
str = str & "','" & Trim(frmUser.Text3.Text) & "','" & Trim(frmUser.Text5.Text) & "',0,'','')"
Pubsaconn.Execute str, 64
Next
End If
Unload Me
End Sub
Private Sub Form_Load()
Dim str As String
Dim i, temp As Integer
lblName.Caption = frmUser.lblName.Caption
str = "select distinct groupname from groupuser "
str = str & "where groupname!='' and username='"
str = str & Trim(lblName.Caption) & "'"
Set RstUser = Pubsaconn.Execute(str)
Do Until RstUser.EOF
List1.AddItem RstUser("groupname"), i
RstUser.MoveNext
i = i + 1
Loop
temp = i
If temp > 0 Then
str = "select distinct groupname from groupuser "
str = str & "where groupname!=''"
For i = 1 To temp
List1.ListIndex = i - 1
str = str & " and groupname!='" & Trim(List1.Text) & "'"
Next
Else
str = "select distinct groupname from groupuser where groupname!=''"
End If
Set RstUser = Pubsaconn.Execute(str)
i = 0
Do Until RstUser.EOF
List2.AddItem RstUser("groupname"), i
RstUser.MoveNext
i = i + 1
Loop
'换皮肤
Call LoadSkin(Me)
End Sub
Private Sub Form_Unload(Cancel As Integer)
SetGride frmUserMain.GrdUser, frmUserMain.GrdGroup
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -