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. C#
  4. Custom User Control and VS.NET 2005

Custom User Control and VS.NET 2005

Scheduled Pinned Locked Moved C#
questioncsharpvisual-studio
4 Posts 3 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.
  • D Offline
    D Offline
    Drew McGhie
    wrote on last edited by
    #1

    I've created a customized control that is basically a textbox with some labels. Among other things, I'm trying to expose a couple attributes of the textbox (called myText). Within the class of the user control, I've put public bool Multiline { get { return myText.Multiline; } set { myText.Multiline = value; } } This is all fine, and I can modify this within code, but how do I get this property to show up in the properties window in the .NET designer? Is there some special tag I need to put before it?

    E M 2 Replies Last reply
    0
    • D Drew McGhie

      I've created a customized control that is basically a textbox with some labels. Among other things, I'm trying to expose a couple attributes of the textbox (called myText). Within the class of the user control, I've put public bool Multiline { get { return myText.Multiline; } set { myText.Multiline = value; } } This is all fine, and I can modify this within code, but how do I get this property to show up in the properties window in the .NET designer? Is there some special tag I need to put before it?

      E Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #2

      That's all you need, if you want to set the description (displayed at the bottom of the property grid) then use the [Description("Your description")] tag, likewise there's a category attribute (when the property grid is in the category view) and a few others such as designer (not applicable to this property). But basically any property is by default displayed in the property grid. To hide it use the [Browsable(false|true)] attribute.


      You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed

      D 1 Reply Last reply
      0
      • D Drew McGhie

        I've created a customized control that is basically a textbox with some labels. Among other things, I'm trying to expose a couple attributes of the textbox (called myText). Within the class of the user control, I've put public bool Multiline { get { return myText.Multiline; } set { myText.Multiline = value; } } This is all fine, and I can modify this within code, but how do I get this property to show up in the properties window in the .NET designer? Is there some special tag I need to put before it?

        M Offline
        M Offline
        microsoc
        wrote on last edited by
        #3

        hi Drew McGhie! :) basically, your code is already fine... maybe the "myText" textbox is not initialized? if the initialization of this textbox was done on the InitializeComponent method... there would be no problem. perhaps you do the initialization by demand? hope this helps! :) microsoc :cool:

        1 Reply Last reply
        0
        • E Ed Poore

          That's all you need, if you want to set the description (displayed at the bottom of the property grid) then use the [Description("Your description")] tag, likewise there's a category attribute (when the property grid is in the category view) and a few others such as designer (not applicable to this property). But basically any property is by default displayed in the property grid. To hide it use the [Browsable(false|true)] attribute.


          You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed

          D Offline
          D Offline
          Drew McGhie
          wrote on last edited by
          #4

          Turns out all I needed to do was re-open the designer where I was trying to use the custom form. That got it showing up. Anyways, thanks for the help, and the advice on [Description()]

          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