Exposing control properties in a composite control (VB) : Extends CompositeControl « Custom Controls « ASP.NET Tutorial






Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls

<DefaultProperty("Text")> _
<ToolboxData("<{0}:[WebCustomControl2] runat=server></{0}:[WebCustomControl2]>")> _
Public Class [WebCustomControl2]
    Inherits System.Web.UI.WebControls.CompositeControl

    Protected textbox As TextBox

    Public Property Text() As String
        Get
            EnsureChildControls()
            Return textbox.Text
        End Get
        Set(ByVal value As String)
            EnsureChildControls()
            textbox.Text = value
        End Set
    End Property


    Protected Overrides Sub CreateChildControls()
        Me.Controls.Add(textbox)
    End Sub

End Class








14.21.Extends CompositeControl
14.21.1.Creating a composite control (C#)
14.21.2.Creating a composite control (VB)
14.21.3.Exposing control properties in a composite control (C#)
14.21.4.Exposing control properties in a composite control (VB)
14.21.5.TitledText Box