473,657 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 = WebCommandLineH elper.CommandLi neArgs(args);

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

TIA,

Steve Wofford
www.IntraRELY.com
Nov 20 '05 #1
5 1640

"IntraRELY" <In*******@yaho o.com> wrote in message news:%2******** ********@TK2MSF TNGP12.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 = WebCommandLineH elper.CommandLi neArgs(args);

string argstring = "";
foreach( string arg in args ) argstring += arg + "\r\n";
MessageBox.Show (argstring, "Args from " +
(WebCommandLine Helper.Launched FromUrl ? "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 = WebCommandLineH elper.CommandLi neArgs(args);

dim argstring as string = ""

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

MessageBox.Show (argstring,iif( WebCommandLineH elper.LaunchedF romUrl ,"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.co mputetosuit.com > wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..

"IntraRELY" <In*******@yaho o.com> wrote in message news:%2******** ********@TK2MSF TNGP12.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 = WebCommandLineH elper.CommandLi neArgs(args);

string argstring = "";
foreach( string arg in args ) argstring += arg + "\r\n";
MessageBox.Show (argstring, "Args from " +
(WebCommandLine Helper.Launched FromUrl ? "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 = WebCommandLineH elper.CommandLi neArgs(args);

dim argstring as string = ""

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

MessageBox.Show (argstring,iif( WebCommandLineH elper.LaunchedF romUrl ,"URL", "EXE))
end sub

Nov 20 '05 #3
* "IntraRELY" <In*******@yaho o.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 = WebCommandLineH elper.CommandLi neArgs(args);

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


C# -> VB.NET Converters:

<http://www.aspalliance .com/aldotnet/examples/translate.aspx>
<http://www.kamalpatel. net/ConvertCSharp2V B.aspx>
<http://csharpconverter .claritycon.com/Default.aspx>
<http://www.ragingsmurf .com/vbcsharpconvert er.aspx>
<http://www.gotdotnet.c om/Community/UserSamples/Details.aspx?Sa mpleGuid=c62234 8b-18a9-47d6-8687-979975d5957d>

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

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

"IntraRELY" <In*******@yaho o.com> wrote in message news:uH******** ******@TK2MSFTN GP09.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.Env ironment.GetCom mandLineArgs())
End Sub

Overloads Shared Sub Main(args() As String)
args = WebCommandLineH elper.CommandLi neArgs(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
WebCommandLineH elper.LaunchedF romUrl 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 = WebCommandLineH elper.CommandLi neArgs(args);

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

TIA,

Steve Wofford
www.IntraRELY.com


--
Best Regards - OHM

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

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

Similar topics

1
5649
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 at the bottom. Hope you can help me understand the "explicit" keyword and its usage. Specifically, Is "explicit" keyword only associated with constructor in C++? What's "implied conversion of types"?
7
3256
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 I couldn't find the exact rule in the C++ standard. And what if the classes have template parameters? It would be great if somebody could get me a rough hint where in the
16
5117
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. And K&R2 mentions "signed extension" everywhere. Reading some old clc posts, I've beginning to realize that these books are over-generalizing the topic. I am just wondering what the difference between the following pairs of terms are: 1)...
31
6618
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 variable becomes 364 and the other one becomes 365. Does anyone have any insight to what the problem is? Thanks in advance. Bjørn
11
7606
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 Test. I expected the same error from the following line, but it compiles fine. The double is silently truncated to an int and then fed in to the implicit conversion operator. Why does this happen? Is there any way that I can keep the implicit...
2
6865
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 static explicit System.IntPtr (long);
3
4446
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 calling the constructor 'MyString::MyString(const wchar_t *)' c:\SrNet\jury\JuryTest.h(21) : see declaration of 'MyString::MyString' The class "StringData" uses a, whatever you call it, operator const
0
2289
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 pages to a variety of formats. SII's service bureau has a reputation as being a least-cost provider that can offer a timely turnaround with 100% accuracy. Here are some of the formats SII has converted over the last 20 years:
0
1860
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 provides form data entry, data capture, HTML/SGML coding, image scanning, file conversion with low cost, high quality,99.98% accuracy and time bound. Data Conversion Services offer cost effective data conversion projects, Outsourcing Data...
21
2442
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 type is not a single identifier or keyword. Which one is correct? For example: unsigned long x = unsigned long(y); REH
0
8399
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6169
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.