The problem is that when I add this control in design view I get an "Object not set to an instance of an object"...
dialog box. In the declaration section, I have a reference to a data access business object I wrote. This will take care of running the stored procedure and adding parameters. I also have four methods that mimic the AddParamter methods of the SQLCommand object.
If I override the OnLoad event and create the instance of my DataAccess object there, instead of in the declarations section, everything works fine.
Any ideas why it works when I put it in the OnLoad but not in the declarations? Also, if I put it in the OnLoad, then users can't use this in the Page_Load. They have to use it in the Page_Prerender.
I would recommend that you review the Control execution lifecycle. If you have the MSDN Library installed, you can find this using the index and the query 'Control Execution Lifecycle', or by simply searching Google for the same phrase.
Do you have comments on this Ask the Expert question and response? Let us know.
Dig Deeper on Win Development Resources
Related Q&A from Mark Belles
This expert response shows how to access VB .NET Windows control on the client side. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.