cast in VB.Net

G

Guest

Dim uc As UserControl
uc = LoadControl("\usercontrol\topheader.ascx")
Dim top As TopHeader
How do I convert uc to datatype TopHeader?
In C# I would do a cast. I have forgot how to do a cast in VB.Net
 
G

Guest

Hi,
try this code:
dim r as topheader= ctype(Page.LoadControl("\usercontrol\topheader.ascx"),
topheader)
Where topheader is the name of usercontrol class
 

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
473,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top