usercontrol datatype

G

Guest

My code
Dim AgentControl As UserControl
AgentControl = LoadControl("AgentVerification.ascx")
How do I change my usercontrol to type AgentVerification so I can invoke
properties and methods in my usercontrol?
 
R

Riki

Arne said:
My code
Dim AgentControl As UserControl
AgentControl = LoadControl("AgentVerification.ascx")
How do I change my usercontrol to type AgentVerification so I can
invoke properties and methods in my usercontrol?

Make sure that the ClassName property is set in the Control directive (first
line of AgentVerification.ascx).

Then you can use a cast:
Dim AgentControl As myClassName
AgentControl = CType(LoadControl("AgentVerification.ascx"),myClassName)
 

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

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top