To convert C# code to VB.Net or vice versa, you may need the following tools.
Language Convert.
Language convert is a simple plug-in for Visual Studio 2010 and 2012 allows you to convert VB.net code to C# and VB.net in C#.
Convert
Convert by FishCodeLib.com is a (6-in-1) integrated, powerful, multi-purpose conversion and developer tool that can also convert C# code to VB.Net and vice versa.
Developerfusion converter.
DeveloperFusion is a free web based utility that automatically converts C# to its equivalent in VB.NET and vice-versa, it allows you zip and entire project and convert it.
VB.Net to C# converter.[
^]
This a shareware(not free) desktop application. Their claim
VBconversions.com says:
The Most Accurate VB.Net to C# Converter Money Can Buy
And they've got some
testimonials too. ;)
And for a do it 'myself' way? You can start from the following links, CP has one too, kinda old though.
Complete Comparison for VB.NET and C#[
^]
A Code project article that explains about advantages, differences and new features of VB.NET and C#. Last Updated.
18 Apr 2005
Comparison For C# and VB.Net[
^]
A
wiki article that explains the similarities, history and differences between C# and VB.Net.
Vb.Net and C# comparison[
^]
For further reading....
For more articles, try
GOOGLE.[
^]
Okay, are you still here? Your code in VB.Net
Private Function DecryptPassWord(ByVal PassWord As String) As String
Dim i As Integer
Dim dcrpChar, dcrpString As String
dcrpChar = ""
dcrpString = ""
For i = 1 To Len(PassWord)
dcrpChar = 275 - Asc(Mid(PassWord, i, 1))
dcrpString = Chr(dcrpChar) & dcrpString
Next i
DecryptPassWord = dcrpString
End Function
translates to in C# as
...First, in your code, the code
Asc(Mid(PassWord, i, 1))
. You should know that the functions Asc() and Mid() are not available, the first thing you should do is import
Microsoft.VisualBasic
so, in your using statements, you should add
using Microsoft.VisualBasic;
Now, your code would be....
private string decryptpassword(string password)
{
string dcrpChar, dcrpString;
dcrpChar="";
dcrpString="";
for (int i=1; i<=password.Length(); i+=1)
{
dcrpChar = 275 - Asc(PassWord.Substring( i, 1));
dcrpString = (Char)dcrpChar + dcrpString;
}
return dcrpString;
}