C# conversion to VB

I

IntraRELY

I need to convert the following code. The online conversion tool could do it
w/o error. Any help appreciated.

static void Main(string[] args) {
args = WebCommandLineHelper.CommandLineArgs(args);

string argstring = "";
foreach( string arg in args ) argstring += arg + "\r\n";
MessageBox.Show(argstring, "Args from " +
(WebCommandLineHelper.LaunchedFromUrl ? "URL" : "EXE"));
}
}

TIA,

Steve Wofford
www.IntraRELY.com
 
R

Rick Mogstad

IntraRELY said:
I need to convert the following code. The online conversion tool could do it
w/o error. Any help appreciated.

if the online tool can do it to your satisfaction, why are you posting it here?
static void Main(string[] args) {
args = WebCommandLineHelper.CommandLineArgs(args);

string argstring = "";
foreach( string arg in args ) argstring += arg + "\r\n";
MessageBox.Show(argstring, "Args from " +
(WebCommandLineHelper.LaunchedFromUrl ? "URL" : "EXE"));
}
}


I cant say that the below code is completely correct (best practice wise), but It should run and
do what you wanted. I dont particularly like using IIF, but thats what would be the most direct
translation. Odd to think that i dont know C# and I was still able to do this, eh? I bet you
could have figured it out too.



public sub Main(args() as string)
args = WebCommandLineHelper.CommandLineArgs(args);

dim argstring as string = ""

for each arg as string in args
argstring += arg & vbCrLf
next

MessageBox.Show(argstring,iif(WebCommandLineHelper.LaunchedFromUrl ,"URL", "EXE))

end sub
 
H

Herfried K. Wagner [MVP]

* "IntraRELY said:
I need to convert the following code. The online conversion tool could do it
w/o error. Any help appreciated.

static void Main(string[] args) {
args = WebCommandLineHelper.CommandLineArgs(args);

string argstring = "";
foreach( string arg in args ) argstring += arg + "\r\n";
MessageBox.Show(argstring, "Args from " +
(WebCommandLineHelper.LaunchedFromUrl ? "URL" : "EXE"));
}
}

C# -> VB.NET Converters:

<http://www.aspalliance.com/aldotnet/examples/translate.aspx>
<http://www.kamalpatel.net/ConvertCSharp2VB.aspx>
<http://csharpconverter.claritycon.com/Default.aspx>
<http://www.ragingsmurf.com/vbcsharpconverter.aspx>
<http://www.gotdotnet.com/Community/...mpleGuid=c622348b-18a9-47d6-8687-979975d5957d>

<http://www.remotesoft.com/>
-> "Octopus"
 
I

IntraRELY

Thanks Rick, I meant Could NOT, but I am sure you figured it out.

I dont know C# either, but was able to figure a portion out, but the \r\n
threw me off. Thanks for you help.


Rick Mogstad said:
I need to convert the following code. The online conversion tool could do it
w/o error. Any help appreciated.

if the online tool can do it to your satisfaction, why are you posting it here?
static void Main(string[] args) {
args = WebCommandLineHelper.CommandLineArgs(args);

string argstring = "";
foreach( string arg in args ) argstring += arg + "\r\n";
MessageBox.Show(argstring, "Args from " +
(WebCommandLineHelper.LaunchedFromUrl ? "URL" : "EXE"));
}
}


I cant say that the below code is completely correct (best practice wise), but It should run and
do what you wanted. I dont particularly like using IIF, but thats what would be the most direct
translation. Odd to think that i dont know C# and I was still able to do this, eh? I bet you
could have figured it out too.



public sub Main(args() as string)
args = WebCommandLineHelper.CommandLineArgs(args);

dim argstring as string = ""

for each arg as string in args
argstring += arg & vbCrLf
next

MessageBox.Show(argstring,iif(WebCommandLineHelper.LaunchedFromUrl ,"URL", "EXE))

end sub
 
R

Rick Mogstad

IntraRELY said:
Thanks Rick, I meant Could NOT, but I am sure you figured it out.

I dont know C# either, but was able to figure a portion out, but the \r\n
threw me off. Thanks for you help.

those are excape characters. \r = carriage return \n = newline.

Glad I could help.
 
O

One Handed Man

Public Overloads Shared Sub Main()
Main(System.Environment.GetCommandLineArgs())
End Sub

Overloads Shared Sub Main(args() As String)
args = WebCommandLineHelper.CommandLineArgs(args)

Dim argstring As String = ""
Dim arg As String
For Each arg In args
argstring += arg + ControlChars.Cr + ControlChars.Lf
Next arg
MessageBox.Show(argstring, "Args from " + (If
WebCommandLineHelper.LaunchedFromUrl Then "URL" Else "EXE"))
End Sub 'Main



I need to convert the following code. The online conversion tool
could do it w/o error. Any help appreciated.

static void Main(string[] args) {
args = WebCommandLineHelper.CommandLineArgs(args);

string argstring = "";
foreach( string arg in args ) argstring += arg + "\r\n";
MessageBox.Show(argstring, "Args from " +
(WebCommandLineHelper.LaunchedFromUrl ? "URL" : "EXE"));
}
}

TIA,

Steve Wofford
www.IntraRELY.com
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top