This topic has not yet been rated - Rate this topic

Convert.ToInt32 Method (String, Int32)

.NET Framework 1.1

Converts the String representation of a number in a specified base to an equivalent 32-bit signed integer.

[Visual Basic]
Overloads Public Shared Function ToInt32( _
   ByVal value As String, _
   ByVal fromBase As Integer _
) As Integer
[C#]
public static int ToInt32(
 string value,
 int fromBase
);
[C++]
public: static int ToInt32(
 String* value,
 int fromBase
);
[JScript]
public static function ToInt32(
   value : String,
 fromBase : int
) : int;

Parameters

value
A String containing a number.
fromBase
The base of the number in value, which must be 2, 8, 10, or 16.

Return Value

A 32-bit signed integer equivalent to the number in value.

-or-

Zero if value is a null reference (Nothing in Visual Basic).

Exceptions

Exception Type Condition
ArgumentException fromBase is not 2, 8, 10, or 16.

Remarks

If fromBase is 16, you can prefix the number specified by the value parameter with "0x" or "0X".

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

Convert Class | Convert Members | System Namespace | Convert.ToInt32 Overload List

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.