user control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • belgie

    #1

    user control

    My user control public method doesn't work, although there are no build
    errors in the project.

    It is a simple user control named UserControl1, with a public method. The
    method changes the Text property of a control on the user control.

    Public Class UserControl1
    Inherits System.Web.UI.U serControl
    Public WithEvents TextBox1 As
    System.Web.UI.W ebControls.Text Box
    Public WithEvents Label1 As System.Web.UI.W ebControls.Labe l
    Public WithEvents Button1 As
    System.Web.UI.W ebControls.Butt on

    Public Sub ChangeText(ByVa l sNew As String)
    TextBox1.Text = sNew
    End Sub
    End Class

    I add the user control to a containing page. I have a button on the page
    which calls the ChangeText method on the user control.

    Public WithEvents UserControl11 As UserControl1

    Private Sub Button1_Click(B yVal sender As System.Object, ByVal e
    As System.EventArg s) Handles Button1.Click
    UserControl11.C hangeText(Me.Te xtBox1.Text)
    End Sub

    There are no build errors. The User Control public method is displayed by
    Intellisense. Everything appears to work fine, except that the text box on
    the user control is not changed.

    I would appreciate any suggestions..

    Thanks!
    Bill



Working...