Results 1 to 4 of 4

Thread: [RESOLVED] [2.0] Trouble porting C# code to VB

  1. #1

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Resolved [RESOLVED] [2.0] Trouble porting C# code to VB

    I was recently tasked the difficult job of porting some C# code to VB. I have no experience in writing C# code however I am comfortable with .NET and VB. So far I have successfully ported most of the code, however the following line puzzles me:

    Code:
    FillPrimitive fill = (FillPrimitive)this.examplesCrs.CrsElement.Children[0];
    How would I port this to VB? The FillPrimitive part in parentheses puzzles me...
    Last edited by obi1kenobi; Dec 31st, 2008 at 07:31 AM.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Trouble porting C# code to VB

    That is an explicit cast, which is done in VB with DirectCast.

    By the way, they are parentheses, not brackets. The index 0 at the end of the line is in brackets.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2.0] Trouble porting C# code to VB

    Wow thanks!
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [2.0] Trouble porting C# code to VB

    Something like
    Code:
    Dim fill As FillPrimitive = DirectCast(Me.examplesCrs.CrsElement.Children(0), FillPrimitive)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width