home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / PVb5.0 / VB / SAMPLES / VISDATA / NEWUG.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-01-12  |  4.1 KB  |  145 lines

  1. VERSION 5.00
  2. Begin VB.Form frmNewUserGroup 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    ClientHeight    =   1935
  5.    ClientLeft      =   3990
  6.    ClientTop       =   3525
  7.    ClientWidth     =   3480
  8.    BeginProperty Font 
  9.       Name            =   "
  10.       Size            =   9
  11.       Charset         =   134
  12.       Weight          =   400
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    HelpContextID   =   2016137
  18.    Icon            =   "NEWUG.frx":0000
  19.    LinkTopic       =   "Form1"
  20.    LockControls    =   -1  'True
  21.    MaxButton       =   0   'False
  22.    MinButton       =   0   'False
  23.    ScaleHeight     =   1935
  24.    ScaleWidth      =   3480
  25.    ShowInTaskbar   =   0   'False
  26.    StartUpPosition =   1  'CenterOwner
  27.    Begin VB.CommandButton cmdCancel 
  28.       Cancel          =   -1  'True
  29.       Caption         =   "
  30. (&C)"
  31.       Default         =   -1  'True
  32.       Height          =   375
  33.       Left            =   1800
  34.       MaskColor       =   &H00000000&
  35.       TabIndex        =   5
  36.       Top             =   1440
  37.       Width           =   1455
  38.    End
  39.    Begin VB.CommandButton cmdOK 
  40.       Caption         =   "
  41. (&O)"
  42.       Enabled         =   0   'False
  43.       Height          =   375
  44.       Left            =   240
  45.       MaskColor       =   &H00000000&
  46.       TabIndex        =   4
  47.       Top             =   1440
  48.       Width           =   1455
  49.    End
  50.    Begin VB.TextBox txtPID 
  51.       Height          =   285
  52.       Left            =   120
  53.       MaxLength       =   20
  54.       TabIndex        =   3
  55.       Top             =   960
  56.       Width           =   3255
  57.    End
  58.    Begin VB.TextBox txtName 
  59.       Height          =   285
  60.       Left            =   120
  61.       TabIndex        =   1
  62.       Top             =   360
  63.       Width           =   3255
  64.    End
  65.    Begin VB.Label lblLabels 
  66.       AutoSize        =   -1  'True
  67.       Caption         =   "PID
  68.       Height          =   195
  69.       Index           =   1
  70.       Left            =   120
  71.       TabIndex        =   2
  72.       Top             =   720
  73.       Width           =   315
  74.    End
  75.    Begin VB.Label lblLabels 
  76.       AutoSize        =   -1  'True
  77.       Caption         =   "
  78.       Height          =   195
  79.       Index           =   0
  80.       Left            =   120
  81.       TabIndex        =   0
  82.       Top             =   120
  83.       Width           =   465
  84.    End
  85. Attribute VB_Name = "frmNewUserGroup"
  86. Attribute VB_GlobalNameSpace = False
  87. Attribute VB_Creatable = False
  88. Attribute VB_PredeclaredId = True
  89. Attribute VB_Exposed = False
  90. Option Explicit
  91. '>>>>>>>>>>>>>>>>>>>>>>>>
  92. Const BUTTON1 = "
  93. (&O)"
  94. Const BUTTON2 = "
  95. (&C)"
  96. Const Label1 = "
  97. Const Label2 = "&PID
  98. Const MSG1 = "PID 
  99. '>>>>>>>>>>>>>>>>>>>>>>>>
  100. Public UserOrGroup As Integer
  101. Private Sub cmdCancel_Click()
  102.   Unload Me
  103. End Sub
  104. Private Sub cmdOK_Click()
  105.   On Error GoTo OKErr
  106.   Dim sTmp As String
  107.   Dim usr As User
  108.   Dim grp As Group
  109.   If Len(txtPID) < 4 Then
  110.     Beep
  111.     MsgBox MSG1, 48
  112.     Exit Sub
  113.   End If
  114.   If UserOrGroup = 0 Then
  115.     Set usr = gwsMainWS.CreateUser(txtName.Text, txtPID.Text)
  116.     gwsMainWS.Users.Append usr
  117.     gwsMainWS.Groups.Refresh
  118.     frmGroupsUsers.lstUsers.AddItem txtName.Text
  119.     frmGroupsUsers.lstGroupsUsers.AddItem txtName.Text
  120.     '
  121.     On Error Resume Next  '
  122.     gwsMainWS.Groups("Users").Users.Append usr
  123.     gwsMainWS.Users(txtName.Text).Groups.Refresh
  124.   Else
  125.     Set grp = gwsMainWS.CreateGroup(txtName.Text, txtPID.Text)
  126.     gwsMainWS.Groups.Append grp
  127.     gwsMainWS.Users.Refresh
  128.     frmGroupsUsers.lstGroups.AddItem txtName.Text
  129.     frmGroupsUsers.lstUsersGroups.AddItem txtName.Text
  130.   End If
  131.   Unload Me
  132.   Exit Sub
  133. OKErr:
  134.   ShowError
  135. End Sub
  136. Private Sub Form_Load()
  137.   cmdOK.Caption = BUTTON1
  138.   cmdCancel.Caption = BUTTON2
  139.   lblLabels(0).Caption = Label1
  140.   lblLabels(1).Caption = Label2
  141. End Sub
  142. Private Sub txtName_Change()
  143.   cmdOK.Enabled = Len(txtName.Text) > 0
  144. End Sub
  145.