VB6 to C# conversion

来源:百度知道 编辑:UC知道 时间:2024/06/13 23:22:21
Dim a As Integer
a = Val("123dsfd") '//I do not know how to carry out such data format conversion
'// int b =Convert.ToInt32(a);//This is wrong!
MsgBox a

Thank you for your help, my friend!

if you set a as integer
you don't set a as "12323" ->string
you should set a as a=123;
and int b=Convert.ToInt32("ff") Ofcourse it's wrong
you should like this
int b=Convert.ToInt32(12.55);
result b=12;

Val().
Returns a numeric or currency value from a character expression composed of numbers. You can use VAL( ) to convert the character strings returned by the Visual Basic SYS( ) functions to numeric values.

a variable is already Integer. don' t need convert.