TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Deon
NA
1
0
Code Convert from VB.net to C#
Jul 1 2010 2:46 AM
Hi Guys
I'm having problems converting this code below from vb.net to c# can someone please help ??
Public Function CryptData(ByVal Text As String) As String
Dim strTempChar As String
Dim i As Integer
For i = 1 To Len(Text)
If Asc(Mid$(Text, i, 1)) < 128 Then
strTempChar = CType(Asc(Mid$(Text, i, 1)) + 128, String)
ElseIf Asc(Mid$(Text, i, 1)) > 128 Then
strTempChar = CType(Asc(Mid$(Text, i, 1)) - 128, String)
End If
Mid$(Text, i, 1) = Chr(CType(strTempChar, Integer))
Next i
Return Text
End Function
This is the code after I convert it to C#
public string CryptData(string Text)
{
string strTempChar = null;
int i = 0;
for (i = 1; i <= Len(Text); i++)
{
if (Asc(Mid(Text, i, 1)) < 128)
{
strTempChar = Convert.ToString(Asc(Mid(Text, i, 1)) + 128);
}
else if (Asc(Mid(Text, i, 1)) > 128)
{
strTempChar = Convert.ToString(Asc(Mid(Text, i, 1)) - 128);
}
Mid(Text, i, 1) == Chr(Convert.ToInt32(strTempChar));
}
}
The application is giving loads of errors like
Error 1 The name 'Len' does not exist in the current context
Error 2 The name 'Asc' does not exist in the current context
Error 3 The name 'Mid' does not exist in the current context
Can someone please help me ???
Regards
VX
Reply
Answers (
2
)
Need help in solving this error.
get popup window form's datatable from parent form