I try to change this function into a C# function.
However, some of the methods are not supported in C#.
For example, I can’t really find the " Asc() " [ According to MSDN : Returns the ANSI character code corresponding to the first letter in a string.
] in C#.
So I planned to use this “Convert.ToInt32()” to solve this problem, but for some reasons I can’t find this in MF4.1.
[b] Public Function WriteStr(ByRef Str As String) As Boolean
Dim SData(Str.Length - 1) As Byte
Dim i As Long
WriteStr = True
SockErr = 0
For i = 0 To Str.Length - 1
SData(i) = Asc(Str.Chars(i))
Next i
WriteStr = WriteBin(SData, Str.Length)
End Function[/b]
So I planned to use this “Convert.ToInt32()” to solve this problem, but for some reasons I can’t find this in MF4.1.
You could use
Int32.Parse(String);
or
Int32.Parse(String, NumberStyles);
or
Int32.Parse(String, IFormatProvider) ;
or
Int32.Parse(String, String, NumberStyles, IFormatProvider) ;