473,383 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

C# conversion to VB

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
Nov 20 '05 #1
5 1633

"IntraRELY" <In*******@yahoo.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
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

Nov 20 '05 #2
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" <ri**@NOSPAM.computetosuit.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

"IntraRELY" <In*******@yahoo.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
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

Nov 20 '05 #3
* "IntraRELY" <In*******@yahoo.com> scripsit:
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/UserSamples/Details.aspx?SampleGuid=c622348b-18a9-47d6-8687-979975d5957d>

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

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

"IntraRELY" <In*******@yahoo.com> wrote in message news:uH**************@TK2MSFTNGP09.phx.gbl...
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.
Nov 20 '05 #5
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


IntraRELY wrote:
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


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stub | last post by:
Docs says that "The compiler does not use an explicit constructor to implement an implied conversion of types. It's purpose is reserved explicitly for construction." I put up code of three cases...
7
by: Michael Lehn | last post by:
Hi, I have a question regarding the conversion of objects. When is the conversion done by the constructor and when by the operator. My feeling tells me that the constructor is preferred. But...
16
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. ...
31
by: Bjørn Augestad | last post by:
Below is a program which converts a double to an integer in two different ways, giving me two different values for the int. The basic expression is 1.0 / (1.0 * 365.0) which should be 365, but one...
11
by: Steve Gough | last post by:
Could anyone please help me to understand what is happening here? The commented line produces an error, which is what I expected given that there is no conversion defined from type double to type...
2
by: Alex Sedow | last post by:
Why explicit conversion from SomeType* to IntPtr is not ambiguous (according to standart)? Example: // System.IntPtr class IntPtr { public static explicit System.IntPtr (int); public...
3
by: Steve Richter | last post by:
here is a warning I am getting in a C++ .NET compile: c:\SrNet\jury\JuryTest.cpp(55) : warning C4927: illegal conversion; more than one user-defined conversion has been implicitly applied while...
0
by: Lou Evart | last post by:
DOCUMENT CONVERSION SERVICES Softline International (SII) operates one of the industry's largest document and data conversion service bureaus. In the past year, SII converted over a million...
0
by: dataentryoffshore | last post by:
Get a Discount up to 60% on data entry, data capture, dataentry services, large volume data processing and data conversion services through offshore facilities in India. Offshore data entry also...
21
by: REH | last post by:
It it permissible to use the constructor style cast with primitives such as "unsigned long"? One of my compilers accepts this syntax, the other does not. The failing one chokes on the fact that the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.