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 -- Certified Geek
"Arne" wrote in message news:54E5150F-6FD2-4B3F-9170-747D4EF17A1B@microsoft.com... > In C# I would do a cast. I have forgot how to do a cast in VB.Net http://www.codeproject.com/dotnet/CheatSheetCastingNET.asp -- Mark Rae ASP.NET MVP http://www.markrae.net
Hi, try this code: dim r as topheader= ctype(Page.LoadControl("\usercontrol\topheader.ascx"), topheader) Where topheader is the name of usercontrol class -- Hope this helps. Thanks and Regards. Manish Bafna. MCP and MCTS. "Arne" wrote: > 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 > -- > Certified Geek