Tags: | Categories: Blog Posted by admin on 3/9/2009 5:55 PM | Comments (0)

This is a response for all the emails I have received about using Composite Control in VB:


The previous post was in C# 



Second part using VB.NET:

Imports System

Imports System.Collections.Generic

Imports System.ComponentModel

Imports System.Text

Imports System.Web

Imports System.Web.UI

Imports System.Web.UI.WebControls



<DefaultProperty("Text"), ToolboxData("<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>")> _

Public Class WebCustomControl1

    Inherits CompositeControl


    Protected Literal1 As Literal



    <Bindable(True), Category("Appearance"), DefaultValue(""), Localizable(True)> Property Text() As String


            Dim s As String = CStr(ViewState("Text"))

            If s Is Nothing Then

                Return String.Empty


                Return s

            End If

        End Get




        Set(ByVal Value As String)

            ViewState("Text") = Value

        End Set

    End Property



    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)




    End Sub



    Protected Overrides Sub CreateChildControls()



        Literal1 = New Literal()

        Literal1.Text = "<BR>"



    End Sub


    Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)





    End Sub


End Class


blog comments powered by Disqus