T
Tina
This is an issue regarding what exactly is accomplished by using "Protected"
when defining a variable. It seems it does much more than just applying
Protected status to a variable.
I have an ascx control named HeadingBar. I have dragged it onto an aspx
page.
If I use the following statement.....
Dim HeadingBar1 as HeadingBar
This defines HeadingBar1 but, of course, does not instantiate it so
HeadingBar1 is nothing. (no suprise here)
If I use the following statement.....
Protected HeadingBar1 as HeadingBar
This not only defines HeadingBar1 but it also instantiates it as
ASP.HeadingBar_ascx. Here it seems that "Protected" is doing more than
giving a variable protected status - it's instantiating an instance!
Everything works fine when this is used.
If I use the following statement.....
Dim HeadingBar1 as HeadingBar = new HeadingBar
It instantiates HeadingBar1 as myProjectName.HeadingBar! Here it's an
object of my project. But when the statement HeadingBar1.Title = "This is
the heading" is executed the Title property in the ascx control throws an
exception on the Set statement of that property saying that lblTitle.text is
not instantiated.
It seems "Protected" is performing some functionality that I cannot find in
the docs. Can anyone explain this?
Thanks,
T
when defining a variable. It seems it does much more than just applying
Protected status to a variable.
I have an ascx control named HeadingBar. I have dragged it onto an aspx
page.
If I use the following statement.....
Dim HeadingBar1 as HeadingBar
This defines HeadingBar1 but, of course, does not instantiate it so
HeadingBar1 is nothing. (no suprise here)
If I use the following statement.....
Protected HeadingBar1 as HeadingBar
This not only defines HeadingBar1 but it also instantiates it as
ASP.HeadingBar_ascx. Here it seems that "Protected" is doing more than
giving a variable protected status - it's instantiating an instance!
Everything works fine when this is used.
If I use the following statement.....
Dim HeadingBar1 as HeadingBar = new HeadingBar
It instantiates HeadingBar1 as myProjectName.HeadingBar! Here it's an
object of my project. But when the statement HeadingBar1.Title = "This is
the heading" is executed the Title property in the ascx control throws an
exception on the Set statement of that property saying that lblTitle.text is
not instantiated.
It seems "Protected" is performing some functionality that I cannot find in
the docs. Can anyone explain this?
Thanks,
T