Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a new property 1

Status
Not open for further replies.

edwardtisdale

Programmer
May 30, 2000
18
0
0
US
I llooked it up in help and found:

(start paste)
Adding Properties to Controls


You implement properties of your ActiveX control by adding property procedures to the code module of the UserControl that forms the basis of your control class.

By default, the only properties your control will have are the extender properties provided by the container. You must decide what additional properties your control needs, and add code to save and retrieve the settings of those properties.

Properties for controls differ in two main ways from properties of other objects you create with Visual Basic.

Property values are displayed in the Properties window and Properties Pages dialog box at design time.


Property values are saved to and retrieved from the container's source file, so that they persist from one programming session to the next.
As a result of these differences, implementing properties for controls has more requirements and options than for other kinds of objects.

Implement Control Properties Using Property Procedures
The most important consequence of the differences listed above is that control properties should always be implemented using property procedures instead of public data members. Otherwise, your control will not work correctly in Visual Basic.

Property procedures are required because you must notify Visual Basic whenever a property value changes. You do this by invoking the PropertyChanged method of the UserControl object at the end of every successful Property Let or Property Set, as shown in the following code fragment.

Private mblnMasked As Boolean

Public Property Get Masked() As Boolean
Masked = mblnMasked
End Property

Public Property Let Masked(ByVal NewValue As Boolean)
mblnMasked = NewValue
PropertyChanged
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top