cast in VB.Net

Discussion in 'ASP .Net' started by =?Utf-8?B?QXJuZQ==?=, Aug 1, 2007.

  1. 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
    =?Utf-8?B?QXJuZQ==?=, Aug 1, 2007
    #1
    1. Advertising

  2. Mark Rae [MVP], Aug 1, 2007
    #2
    1. Advertising

  3. 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
    =?Utf-8?B?TWFuaXNoIEJhZm5h?=, Aug 2, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robin

    date cast error in asp.net page

    Robin, Aug 20, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,781
    Robin
    Aug 23, 2004
  2. =?Utf-8?B?TWlrZQ==?=
    Replies:
    1
    Views:
    547
    Alvin Bruney [MVP - ASP.NET]
    Apr 27, 2005
  3. MSG

    to cast or not to cast malloc ?

    MSG, Feb 6, 2004, in forum: C Programming
    Replies:
    38
    Views:
    1,055
    Dan Pop
    Feb 10, 2004
  4. EvilRix
    Replies:
    8
    Views:
    618
    Martin Dickopp
    Feb 14, 2004
  5. Pavel
    Replies:
    7
    Views:
    510
    Pavel
    Sep 19, 2010
Loading...

Share This Page