JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Adding Properties to Web User Controls

Adding a property to a Web user control is easy; just add a Property statement with Get and Set methods. For more details on the Property statement, see "Creating Properties" in Chapter 11.

For instance, in the WebUserControls example on the CD-ROM, as discussed in the In Depth section of this chapter, we added a property, DisplayColor, to a Web user control; here's the code that supports this property:

    Private LabelColor As Color

    Property DisplayColor() As Color
            Return LabelColor
        End Get

        Set(ByVal Value As Color)
            LabelColor = Value
            Label1.BackColor = LabelColor
        End Set
    End Property

For more details on how this example works, take a look at the In Depth section of this chapter.

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor