DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 1 Aug 2007 14:56:04 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Arne
          2    Mark Rae [MVP]
          3    Manish Bafna


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
Date:Wed, 1 Aug 2007 14:56:04 -0700   Author:  

Re: cast in VB.Net   
"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
Date:Wed, 1 Aug 2007 23:22:39 +0100   Author:  

RE: cast in VB.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
Date:Wed, 1 Aug 2007 23:14:03 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us