J
Julio Sarmiento
Can someone tell me what I am doing wrong??? Below you will find a brief
sample of code that I am using that has a User Control. I know that it is a
lot to ask but I am desperate. The error I receive is: OBJECT REFERENCE NOT
SET TO AN INSTANCE OF THE OBJECT
wuc.ascx
Public MustInherit Class wuc
Inherits System.Web.UI.UserControl
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Calendar1 As System.Web.UI.WebControls.Calendar
Public ReadOnly Property getDate() As String
Get
Return Me.TextBox1.Text
End Get
End Property
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Calendar1.SelectionChanged
Me.TextBox1.Text = Me.Calendar1.SelectedDate
End Sub
End Class
HERE IS THE ASPX
Public Class WebForm5
Inherits System.Web.UI.Page
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim x As test.wuc
Me.TextBox1.Text = x.getDate()
End Sub
End Class
sample of code that I am using that has a User Control. I know that it is a
lot to ask but I am desperate. The error I receive is: OBJECT REFERENCE NOT
SET TO AN INSTANCE OF THE OBJECT
wuc.ascx
Public MustInherit Class wuc
Inherits System.Web.UI.UserControl
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Calendar1 As System.Web.UI.WebControls.Calendar
Public ReadOnly Property getDate() As String
Get
Return Me.TextBox1.Text
End Get
End Property
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Calendar1.SelectionChanged
Me.TextBox1.Text = Me.Calendar1.SelectedDate
End Sub
End Class
HERE IS THE ASPX
Public Class WebForm5
Inherits System.Web.UI.Page
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim x As test.wuc
Me.TextBox1.Text = x.getDate()
End Sub
End Class