Results 1 to 3 of 3

Thread: [RESOLVED] [2005] Custom Property Options

  1. #1

    Thread Starter
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Resolved [RESOLVED] [2005] Custom Property Options

    I have read through many of the previous posts about custom properties but can't seem to find one that deals with my issue. I have a custom control that has custom properties. I understand how to get and set properties, but one of my properties needs to be set to either "in" or "mm". I want to property to display a drop-down menu when selected so the developer can select either "in" or "mm". Can someone offer any guidance? I appreciate all responses.
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Custom Property Options

    Declare an eneumeration with those values and then declare your property of that type:
    vb.net Code:
    1. Public Class UserControl1
    2.  
    3.     Private myField As MyEnumeration
    4.  
    5.     Public Property MyProperty() As MyEnumeration
    6.         Get
    7.             Return myField
    8.         End Get
    9.         Set(ByVal value As MyEnumeration)
    10.             myField = value
    11.         End Set
    12.     End Property
    13.  
    14. End Class
    15.  
    16.  
    17. Public Enum MyEnumeration
    18.     [in]
    19.     mm
    20. End Enum
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: [2005] Custom Property Options

    Superb. Thank you!
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width