JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Adding Methods to Web User Controls

You can add a method to a Web user control as you would to any class; just place the implementation of that method into the user control's code. You can make the method public, protected, or private; see "Creating Methods" in Chapter 11 for more details.

For example, in the WebUserControls example discussed in the In Depth section of this chapter, we added a method named SetText that set the text displayed in the Web user control. Here's what that method looks like:

    Public Sub SetText(ByVal NewText As String)
        Label1.Text = NewText
    End Sub

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

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor