S
Support
Hello:
I have a aspx web page - let's call it main.aspx
It contains a placeholder: Myplaceholder.
I have a web control, lets call it webcontrol which has a code behind class
called webcontrolclass and a label called mycontrollabel
In the webcontrolclass, I have a private sub called:
Sub writetomycontrollabel(stuff as text)
mycontrollabel.text=stuff
End Sub
The code behind main.aspx
Dim MANAGEGENERAL As Control = LoadControl("webcontrol.ascx") ' needed for
the placeholder
Public MyMANAGEGENERAL As New webcontrolclass
I have a sub which is called by a button located on main.aspx
Sub mainaspx_click(usualstuff ) handles mainaspx.Click
MyPlaceholder.Controls.Add(MANAGEGENERAL)
MyMANAGEGENERAL.writetomycontrollabel("hello")
End sub
I get the error message:
Object reference not set to an instance of an object.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
MyMANAGEGENERAL.writetomycontrollabel("hello")
So, I am missing something obvious - but I dont get it.
Help
Thanks
TErry
I have a aspx web page - let's call it main.aspx
It contains a placeholder: Myplaceholder.
I have a web control, lets call it webcontrol which has a code behind class
called webcontrolclass and a label called mycontrollabel
In the webcontrolclass, I have a private sub called:
Sub writetomycontrollabel(stuff as text)
mycontrollabel.text=stuff
End Sub
The code behind main.aspx
Dim MANAGEGENERAL As Control = LoadControl("webcontrol.ascx") ' needed for
the placeholder
Public MyMANAGEGENERAL As New webcontrolclass
I have a sub which is called by a button located on main.aspx
Sub mainaspx_click(usualstuff ) handles mainaspx.Click
MyPlaceholder.Controls.Add(MANAGEGENERAL)
MyMANAGEGENERAL.writetomycontrollabel("hello")
End sub
I get the error message:
Object reference not set to an instance of an object.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
MyMANAGEGENERAL.writetomycontrollabel("hello")
So, I am missing something obvious - but I dont get it.
Help
Thanks
TErry