simple? Object Not Referece not set on a Label control

S

SteveS

Hello. This is driving me nuts. I am coding a control which I have a
label. When I populate the label, I get a "Object reference not set to an
instance of an object". This doesn't make sense to me. Does anyone have
any ideas???? Here is my code:

CONTROL (.ASPX)
<asp:Label ID="lblAppName" Runat="server"></asp:Label>

CONTROL (.VB)

'---Automatically generated by VS.Net 2003!
Protected WithEvents lblAppName As System.Web.UI.WebControls.Label

'--- My Code
Private Sub Page_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.PreRender
lblAppName.Text = "blah blah blah"
End Sub


Thank YOU!

Steve
 
S

SteveS

I figured out the problem! It occurred because I'm creating the control on
the fly and them adding them to the page. For some reason, the .ascx and
..ascx page are not connected when it comes to writing to labels, text boxes,
etc....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,815
Latest member
treekmostly22

Latest Threads

Top