home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmNewUserGroup
- BorderStyle = 3 'Fixed Double
- ClientHeight = 1935
- ClientLeft = 3645
- ClientTop = 3525
- ClientWidth = 3480
- Height = 2340
- HelpContextID = 2016137
- Icon = "NEWUG.frx":0000
- Left = 3585
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1935
- ScaleWidth = 3480
- Top = 3180
- Width = 3600
- Begin VB.CommandButton cmdCancel
- Cancel = -1 'True
- Caption = "&Cancel"
- Default = -1 'True
- Height = 375
- Left = 1800
- TabIndex = 5
- Top = 1440
- Width = 1455
- End
- Begin VB.CommandButton cmdOK
- Caption = "&OK"
- Enabled = 0 'False
- Height = 375
- Left = 240
- TabIndex = 4
- Top = 1440
- Width = 1455
- End
- Begin VB.TextBox txtPID
- Height = 285
- Left = 120
- MaxLength = 20
- TabIndex = 3
- Top = 960
- Width = 3255
- End
- Begin VB.TextBox txtName
- Height = 285
- Left = 120
- TabIndex = 2
- Top = 360
- Width = 3255
- End
- Begin VB.Label lblLabels
- AutoSize = -1 'True
- Caption = "PID:"
- Height = 195
- Index = 1
- Left = 120
- TabIndex = 1
- Top = 720
- Width = 315
- End
- Begin VB.Label lblLabels
- AutoSize = -1 'True
- Caption = "Name:"
- Height = 195
- Index = 0
- Left = 120
- TabIndex = 0
- Top = 120
- Width = 465
- End
- Attribute VB_Name = "frmNewUserGroup"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub cmdCancel_Click()
- Unload Me
- End Sub
- Private Sub cmdOK_Click()
- On Error GoTo OKErr
- Dim sTmp As String
- Dim usr As User
- Dim grp As Group
- If Len(txtPID) < 4 Then
- Beep
- MsgBox "PID must be between 4 and 20 characters!", 48
- Exit Sub
- End If
- If Me.Caption = "New User" Then
- Set usr = gwsMainWS.CreateUser(txtName.Text, txtPID.Text)
- gwsMainWS.Users.Append usr
- gwsMainWS.Groups.Refresh
- frmGroupsUsers.lstUsers.AddItem txtName.Text
- frmGroupsUsers.lstGroupsUsers.AddItem txtName.Text
- 'add the new user to the Users group by default
- On Error Resume Next 'just in case the users group is gone
- gwsMainWS.Groups("Users").Users.Append usr
- gwsMainWS.Users(txtName.Text).Groups.Refresh
- Else
- Set grp = gwsMainWS.CreateGroup(txtName.Text, txtPID.Text)
- gwsMainWS.Groups.Append grp
- gwsMainWS.Users.Refresh
- frmGroupsUsers.lstGroups.AddItem txtName.Text
- frmGroupsUsers.lstUsersGroups.AddItem txtName.Text
- End If
- Unload Me
- Exit Sub
- OKErr:
- ShowError
- Exit Sub
- End Sub
- Private Sub Form_Load()
- CenterMe Me, gnMDIFORM
- End Sub
- Private Sub txtName_Change()
- If Len(txtName.Text) > 0 Then
- cmdOK.Enabled = True
- Else
- cmdOK.Enabled = False
- End If
- End Sub
-