Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   cast in VB.Net (http://www.velocityreviews.com/forums/t526319-cast-in-vb-net.html)

=?Utf-8?B?QXJuZQ==?= 08-01-2007 09:56 PM

cast in VB.Net
 
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

Mark Rae [MVP] 08-01-2007 10:22 PM

Re: cast in VB.Net
 
"Arne" <Arne@discussions.microsoft.com> 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/Ch...CastingNET.asp


--
Mark Rae
ASP.NET MVP
http://www.markrae.net


=?Utf-8?B?TWFuaXNoIEJhZm5h?= 08-02-2007 06:14 AM

RE: cast in VB.Net
 
Hi,
try this code:
dim r as topheader= ctype(Page.LoadControl("\usercontrol\topheader.asc x"),
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



All times are GMT. The time now is 03:01 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.