Display UserControl properties in the Property Window

At design-time, when you set a control's property value, Visual
Basic often provides a list of valid settings in a dropdown list.
To display such a list for your own custom UserControl property
settings, you'll need to add an enumerated property to your
ActiveX Control project. To do so, declare the property's
potential values with the Enum statement, like so

Public Enum UCBorderStyles
    UCBorderNone = 0
    UCBorderFlat = 1
    UCBorderThin = 2
    UCBorderFrame = 3
    UCBorderThick = 4
End Enum


Once you've established the potential values, you'll need to use
the enumerated type in the Property Let and Get statements, as in

Private mintBorderStyle As UCBorderStyles

Public Property Get BorderStyle() As UCBorderStyles
   BorderStyle = mintBorderStyle
End Property

Public Property Let BorderStyle(val As UCBorderStyles)
   mintBorderStyle = val
End Property


Now, when Visual Basic instantiates the control at design time,
the valid UCBorderStyles will appear in the Property Window's
dropdown list for the BorderStyle property.

You might also like...

Comments

ElementK Journals

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Computer Science is no more about computers than astronomy is about telescopes.” - E. W. Dijkstra