Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. convert to C# from VB

convert to C# from VB

Scheduled Pinned Locked Moved ASP.NET
csharptutorial
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hurrem
    wrote on last edited by
    #1

    Hi, this is very common, but I don't know how. How to write this in C#: For i = 0 To aDirs.GetUpperBound(0) as I don't see the step, which is not i++...

    N D 2 Replies Last reply
    0
    • H hurrem

      Hi, this is very common, but I don't know how. How to write this in C#: For i = 0 To aDirs.GetUpperBound(0) as I don't see the step, which is not i++...

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      for ( i =0; i==aDirs.GetUpperBound[0]; i++ )
      {
      //your stuff
      }

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

      H 1 Reply Last reply
      0
      • N N a v a n e e t h

        for ( i =0; i==aDirs.GetUpperBound[0]; i++ )
        {
        //your stuff
        }

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

        H Offline
        H Offline
        hurrem
        wrote on last edited by
        #3

        well, there is still something wrong. Here is my code that I'm trying to rewrite in C#. I used while and as I debugged, it is not working properly. For i = 0 To aFiles.GetUpperBound(0) ' Get the position of the trailing separator. posSep = aFiles(i).LastIndexOf("\") ' Get the full path of the source file. sFile = aFiles(i).Substring((posSep + 1), aFiles(i).Length - (posSep + 1)) Try ' Copy the file. System.IO.File.Copy(aFiles(i), destDir + sFile, False) addToConsoleWindow("Copied " & sFile & " to " & destDir) Catch ex As Exception If overWrite = False Then errorBoxShow(ex.Message) addToConsoleWindow("Skipping..." & ex.Message) Else System.IO.File.Copy(aFiles(i), destDir + sFile, True) addToConsoleWindow("Overwriting old " & sFile & " in " & destDir) End If End Try Next i Thank you for helping me.

        D 1 Reply Last reply
        0
        • H hurrem

          well, there is still something wrong. Here is my code that I'm trying to rewrite in C#. I used while and as I debugged, it is not working properly. For i = 0 To aFiles.GetUpperBound(0) ' Get the position of the trailing separator. posSep = aFiles(i).LastIndexOf("\") ' Get the full path of the source file. sFile = aFiles(i).Substring((posSep + 1), aFiles(i).Length - (posSep + 1)) Try ' Copy the file. System.IO.File.Copy(aFiles(i), destDir + sFile, False) addToConsoleWindow("Copied " & sFile & " to " & destDir) Catch ex As Exception If overWrite = False Then errorBoxShow(ex.Message) addToConsoleWindow("Skipping..." & ex.Message) Else System.IO.File.Copy(aFiles(i), destDir + sFile, True) addToConsoleWindow("Overwriting old " & sFile & " in " & destDir) End If End Try Next i Thank you for helping me.

          D Offline
          D Offline
          Declan Bright
          wrote on last edited by
          #4

          Try this: vb-to-csharp[^]

          Declan Bright www.declanbright.com

          1 Reply Last reply
          0
          • H hurrem

            Hi, this is very common, but I don't know how. How to write this in C#: For i = 0 To aDirs.GetUpperBound(0) as I don't see the step, which is not i++...

            D Offline
            D Offline
            Dave Doknjas
            wrote on last edited by
            #5

            (via Instant C#) for (i = 0; i <= aDirs.GetUpperBound(0); i++) { } Ack - how do you specify "less than or equal to" in this forum?? (I unchecked "Ignore HTML tags ..."). David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter C++ to Ruby Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: converts C# to C++/CLI and VB to C++/CLI

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups