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

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,043
Members
48,769
Latest member
Clifft

Latest Threads

Top