M
MattB
I'm making a reusable class to load and populate user controls based on
database values. I had the basic code working from codebehind, and now
I'm moving it to a reusable class.
Once in the class, Intellisense doesn't like:
LoadControl(myUserControlPath)
So I looked up that method and saw it was a member of TemplateControl,
and tried this:
TemplateControl.LoadControl(myUserControlPath)
And Intellisense says it requires an object reference, so I try this:
Dim TC as TemplateControl
TC.LoadControl(myUserControlPath)
It gets by Intellisense, but gives the runtime error: Object reference
not set to an instance of an object on the line with TC.LoadControl, and
I can't instantiate a new instance of the TemplateControl class either.
Can someone tell me if/how I can make this work from my class so I don't
have to duplicate the code on multiple pages? Thanks!
Matt
database values. I had the basic code working from codebehind, and now
I'm moving it to a reusable class.
Once in the class, Intellisense doesn't like:
LoadControl(myUserControlPath)
So I looked up that method and saw it was a member of TemplateControl,
and tried this:
TemplateControl.LoadControl(myUserControlPath)
And Intellisense says it requires an object reference, so I try this:
Dim TC as TemplateControl
TC.LoadControl(myUserControlPath)
It gets by Intellisense, but gives the runtime error: Object reference
not set to an instance of an object on the line with TC.LoadControl, and
I can't instantiate a new instance of the TemplateControl class either.
Can someone tell me if/how I can make this work from my class so I don't
have to duplicate the code on multiple pages? Thanks!
Matt