Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to hide the parent property in UserControl?

How to hide the parent property in UserControl?

Scheduled Pinned Locked Moved Visual Basic
questiontutorial
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    popalzai
    wrote on last edited by
    #1

    Hi! i have made a user control with combo box over it. now i want to hide the BorderStyle property of the user control so that end user could not change this property. how can i achieve this functionality?

    R 1 Reply Last reply
    0
    • P popalzai

      Hi! i have made a user control with combo box over it. now i want to hide the BorderStyle property of the user control so that end user could not change this property. how can i achieve this functionality?

      R Offline
      R Offline
      Rob Smiley
      wrote on last edited by
      #2

      You need to 'shadow' the BorderStyle property in your control, then set property attributes to hide it from the VS property editor, e.g.

          <Browsable(False), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> \_
          Public Shadows Property BorderStyle() As BorderStyle
              Get
                  Return MyBase.BorderStyle
      
              End Get
              Set(ByVal value As BorderStyle)
                  MyBase.BorderStyle = value
      
              End Set
          End Property
      

      The Browsable attributes hides the property from the VS editor, the DesignerSerializationVisibility atrtibute stop the VS designer generating code for the property in the InitialiseComponent method. You need to use the Shadows keyword in the property def to stop the compiler generating a warning.

      "An eye for an eye only ends up making the whole world blind"

      P 2 Replies Last reply
      0
      • R Rob Smiley

        You need to 'shadow' the BorderStyle property in your control, then set property attributes to hide it from the VS property editor, e.g.

            <Browsable(False), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> \_
            Public Shadows Property BorderStyle() As BorderStyle
                Get
                    Return MyBase.BorderStyle
        
                End Get
                Set(ByVal value As BorderStyle)
                    MyBase.BorderStyle = value
        
                End Set
            End Property
        

        The Browsable attributes hides the property from the VS editor, the DesignerSerializationVisibility atrtibute stop the VS designer generating code for the property in the InitialiseComponent method. You need to use the Shadows keyword in the property def to stop the compiler generating a warning.

        "An eye for an eye only ends up making the whole world blind"

        P Offline
        P Offline
        popalzai
        wrote on last edited by
        #3

        Thanks a lot dear! its working fine.

        1 Reply Last reply
        0
        • R Rob Smiley

          You need to 'shadow' the BorderStyle property in your control, then set property attributes to hide it from the VS property editor, e.g.

              <Browsable(False), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> \_
              Public Shadows Property BorderStyle() As BorderStyle
                  Get
                      Return MyBase.BorderStyle
          
                  End Get
                  Set(ByVal value As BorderStyle)
                      MyBase.BorderStyle = value
          
                  End Set
              End Property
          

          The Browsable attributes hides the property from the VS editor, the DesignerSerializationVisibility atrtibute stop the VS designer generating code for the property in the InitialiseComponent method. You need to use the Shadows keyword in the property def to stop the compiler generating a warning.

          "An eye for an eye only ends up making the whole world blind"

          P Offline
          P Offline
          popalzai
          wrote on last edited by
          #4

          Please tell me one thing. how can i add summary detail for my user control property? the way you can see for anyother property and methods and even for events in objectbrowser.

          R 1 Reply Last reply
          0
          • P popalzai

            Please tell me one thing. how can i add summary detail for my user control property? the way you can see for anyother property and methods and even for events in objectbrowser.

            R Offline
            R Offline
            Rob Smiley
            wrote on last edited by
            #5

            Hi, use the Description attribute. You may also want to check out the Category and DefaultValue attributes, e.g.

            <Description("example property"), DefaultValue(1), Category("Testing")>
            

            All these attributes are in the System.ComponentModel namespace

            "An eye for an eye only ends up making the whole world blind"

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups