Converting C# to VB.net
I had one reader from Germany contact me regarding porting a sample section of my blog posting on using the MpApi in .Net. Unfortunately, I don't use VB.net that often and my time to port it to VB.net is limited, however I found a great online tool that can do this for you.
KamalPatel.net has a nice tool, ConvertCSharp2VB. It's rather simple, you copy and paste C# code into the form and it spits out the same code on VB.net. Here's the sample in C# and VB.net that I used:
C# Sample
SmsMessagingClass messaging = new SmsMessagingClass();
ISmsMessage4 message, reply;
smsMessaging.CreateMessage(out message);
message.SetTargetEndpoint("MyDummyEndpoint");
message.SetPort(80);message.SetBodyFromString("MyMessageBody");
// Send the message using HTTP
messaging.Invoke("https://myHostname", message, out reply);
// Do something with the reply here...
VB.Net Sample
Dim messaging As SmsMessagingClass = New SmsMessagingClass()
Dim message As ISmsMessage4,reply As ISmsMessage4
smsMessaging.CreateMessage( message)
message.SetTargetEndpoint("MyDummyEndpoint")
message.SetPort(80)message.SetBodyFromString("MyMessageBody")
' Send the message using HTTP
messaging.Invoke("https://myHostname",message,out reply)
' Do something with the reply here...
Comments
- Anonymous
October 07, 2008
PingBack from http://www.easycoded.com/converting-c-to-vbnet/