Mega Code Archive

 
Categories / ASP.Net Tutorial / Custom Controls
 

Exposing control properties in a composite control (VB)

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