Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > cast in VB.Net

Reply
Thread Tools

cast in VB.Net

 
 
=?Utf-8?B?QXJuZQ==?=
Guest
Posts: n/a
 
      08-01-2007
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
 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      08-01-2007
"Arne" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFuaXNoIEJhZm5h?=
Guest
Posts: n/a
 
      08-02-2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is the result of valid dynamic cast always equal to the result ofcorrespondent static cast? Pavel C++ 7 09-18-2010 11:35 PM
error C2440: 'return' : cannot convert from 'const char *' to 'const unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Abhijit Bhadra C++ 2 12-01-2004 04:43 PM
malloc - to cast or not to cast, that is the question... EvilRix C Programming 8 02-14-2004 12:08 PM
to cast or not to cast malloc ? MSG C Programming 38 02-10-2004 03:13 PM
how to cast system.intptr to struct BestNews ASP .Net 1 09-03-2003 09:04 AM



Advertisments