convert to C# from VB
-
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++...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
-
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
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. -
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.Try this: vb-to-csharp[^]
Declan Bright www.declanbright.com
-
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++...(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