home *** CD-ROM | disk | FTP | other *** search
/ Programming Microsoft Visual Basic .NET / Programming Microsoft Visual Basic .NET (Microsoft Press)(X08-78517)(2002).bin / setup / vbnet / 17 controls / customcontrolstest / extenderform.vb < prev    next >
Encoding:
Text File  |  2001-12-15  |  7.2 KB  |  181 lines

  1. Public Class ExtenderForm
  2.     Inherits System.Windows.Forms.Form
  3.  
  4. #Region " Windows Form Designer generated code "
  5.  
  6.     Public Sub New()
  7.         MyBase.New()
  8.  
  9.         'This call is required by the Windows Form Designer.
  10.         InitializeComponent()
  11.  
  12.         'Add any initialization after the InitializeComponent() call
  13.  
  14.     End Sub
  15.  
  16.     'Form overrides dispose to clean up the component list.
  17.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  18.         If disposing Then
  19.             If Not (components Is Nothing) Then
  20.                 components.Dispose()
  21.             End If
  22.         End If
  23.         MyBase.Dispose(disposing)
  24.     End Sub
  25.     Friend WithEvents cboRole As System.Windows.Forms.ComboBox
  26.     Friend WithEvents Label1 As System.Windows.Forms.Label
  27.     Friend WithEvents Label2 As System.Windows.Forms.Label
  28.     Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
  29.     Friend WithEvents Label3 As System.Windows.Forms.Label
  30.     Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
  31.     Friend WithEvents Label4 As System.Windows.Forms.Label
  32.     Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
  33.     Friend WithEvents Label5 As System.Windows.Forms.Label
  34.     Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
  35.     Friend WithEvents UserPropExtender1 As CustomControlDemo.UserPropExtender
  36.  
  37.     'Required by the Windows Form Designer
  38.     Private components As System.ComponentModel.Container
  39.  
  40.     'NOTE: The following procedure is required by the Windows Form Designer
  41.     'It can be modified using the Windows Form Designer.  
  42.     'Do not modify it using the code editor.
  43.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  44.         Me.TextBox1 = New System.Windows.Forms.TextBox()
  45.         Me.Label4 = New System.Windows.Forms.Label()
  46.         Me.Label5 = New System.Windows.Forms.Label()
  47.         Me.TextBox4 = New System.Windows.Forms.TextBox()
  48.         Me.UserPropExtender1 = New CustomControlDemo.UserPropExtender()
  49.         Me.Label1 = New System.Windows.Forms.Label()
  50.         Me.cboRole = New System.Windows.Forms.ComboBox()
  51.         Me.Label2 = New System.Windows.Forms.Label()
  52.         Me.Label3 = New System.Windows.Forms.Label()
  53.         Me.TextBox2 = New System.Windows.Forms.TextBox()
  54.         Me.TextBox3 = New System.Windows.Forms.TextBox()
  55.         Me.SuspendLayout()
  56.         '
  57.         'TextBox1
  58.         '
  59.         Me.TextBox1.Location = New System.Drawing.Point(24, 112)
  60.         Me.TextBox1.Name = "TextBox1"
  61.         Me.TextBox1.Size = New System.Drawing.Size(296, 24)
  62.         Me.TextBox1.TabIndex = 3
  63.         Me.TextBox1.Text = "TextBox1"
  64.         Me.UserPropExtender1.SetUserRole(Me.TextBox1, "")
  65.         '
  66.         'Label4
  67.         '
  68.         Me.Label4.Location = New System.Drawing.Point(24, 232)
  69.         Me.Label4.Name = "Label4"
  70.         Me.Label4.Size = New System.Drawing.Size(288, 24)
  71.         Me.Label4.TabIndex = 2
  72.         Me.Label4.Text = "This field is visible only to Accountants"
  73.         Me.UserPropExtender1.SetUserRole(Me.Label4, "")
  74.         '
  75.         'Label5
  76.         '
  77.         Me.Label5.Location = New System.Drawing.Point(24, 304)
  78.         Me.Label5.Name = "Label5"
  79.         Me.Label5.Size = New System.Drawing.Size(280, 32)
  80.         Me.Label5.TabIndex = 2
  81.         Me.Label5.Text = "This field is visible to Accountant and TechSupport roles"
  82.         Me.UserPropExtender1.SetUserRole(Me.Label5, "")
  83.         '
  84.         'TextBox4
  85.         '
  86.         Me.TextBox4.Location = New System.Drawing.Point(24, 344)
  87.         Me.TextBox4.Name = "TextBox4"
  88.         Me.TextBox4.Size = New System.Drawing.Size(296, 24)
  89.         Me.TextBox4.TabIndex = 3
  90.         Me.TextBox4.Text = "TextBox4"
  91.         Me.UserPropExtender1.SetUserRole(Me.TextBox4, "Accountant;TechSupport")
  92.         '
  93.         'UserPropExtender1
  94.         '
  95.         Me.UserPropExtender1.CurrentUserRole = Nothing
  96.         '
  97.         'Label1
  98.         '
  99.         Me.Label1.Location = New System.Drawing.Point(24, 8)
  100.         Me.Label1.Name = "Label1"
  101.         Me.Label1.Size = New System.Drawing.Size(192, 24)
  102.         Me.Label1.TabIndex = 1
  103.         Me.Label1.Text = "Select current user's role"
  104.         Me.UserPropExtender1.SetUserRole(Me.Label1, "")
  105.         '
  106.         'cboRole
  107.         '
  108.         Me.cboRole.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
  109.         Me.cboRole.DropDownWidth = 184
  110.         Me.cboRole.Items.AddRange(New Object() {"(unknown)", "Manager", "Accountant", "TechSupport"})
  111.         Me.cboRole.Location = New System.Drawing.Point(24, 32)
  112.         Me.cboRole.Name = "cboRole"
  113.         Me.cboRole.Size = New System.Drawing.Size(184, 26)
  114.         Me.cboRole.TabIndex = 0
  115.         Me.UserPropExtender1.SetUserRole(Me.cboRole, "")
  116.         '
  117.         'Label2
  118.         '
  119.         Me.Label2.Location = New System.Drawing.Point(24, 88)
  120.         Me.Label2.Name = "Label2"
  121.         Me.Label2.Size = New System.Drawing.Size(288, 24)
  122.         Me.Label2.TabIndex = 2
  123.         Me.Label2.Text = "This field is always visible"
  124.         Me.UserPropExtender1.SetUserRole(Me.Label2, "")
  125.         '
  126.         'Label3
  127.         '
  128.         Me.Label3.Location = New System.Drawing.Point(24, 160)
  129.         Me.Label3.Name = "Label3"
  130.         Me.Label3.Size = New System.Drawing.Size(288, 24)
  131.         Me.Label3.TabIndex = 2
  132.         Me.Label3.Text = "This field is visible only to Managers"
  133.         Me.UserPropExtender1.SetUserRole(Me.Label3, "")
  134.         '
  135.         'TextBox2
  136.         '
  137.         Me.TextBox2.Location = New System.Drawing.Point(24, 184)
  138.         Me.TextBox2.Name = "TextBox2"
  139.         Me.TextBox2.Size = New System.Drawing.Size(296, 24)
  140.         Me.TextBox2.TabIndex = 3
  141.         Me.TextBox2.Text = "TextBox2"
  142.         Me.UserPropExtender1.SetUserRole(Me.TextBox2, "Manager")
  143.         '
  144.         'TextBox3
  145.         '
  146.         Me.TextBox3.Location = New System.Drawing.Point(24, 256)
  147.         Me.TextBox3.Name = "TextBox3"
  148.         Me.TextBox3.Size = New System.Drawing.Size(296, 24)
  149.         Me.TextBox3.TabIndex = 3
  150.         Me.TextBox3.Text = "TextBox3"
  151.         Me.UserPropExtender1.SetUserRole(Me.TextBox3, "Accountant")
  152.         '
  153.         'Form1
  154.         '
  155.         Me.AutoScaleBaseSize = New System.Drawing.Size(7, 17)
  156.         Me.ClientSize = New System.Drawing.Size(416, 381)
  157.         Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label5, Me.TextBox4, Me.Label4, Me.TextBox3, Me.Label3, Me.TextBox2, Me.TextBox1, Me.Label2, Me.Label1, Me.cboRole})
  158.         Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
  159.         Me.Name = "Form1"
  160.         Me.Text = "Extender provider "
  161.         Me.UserPropExtender1.SetUserRole(Me, "")
  162.         Me.ResumeLayout(False)
  163.  
  164.     End Sub
  165.  
  166. #End Region
  167.  
  168.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  169.         cboRole.SelectedIndex = 0
  170.     End Sub
  171.  
  172.     Private Sub cboRole_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboRole.SelectedIndexChanged
  173.         If cboRole.SelectedIndex = 0 Then
  174.             UserPropExtender1.CurrentUserRole = ""
  175.         Else
  176.             UserPropExtender1.CurrentUserRole = cboRole.Text
  177.         End If
  178.  
  179.     End Sub
  180. End Class
  181.