This documentation is archived and is not being maintained.

Convert.ToString Method (Single)

Converts the value of the specified single-precision floating point number to its equivalent String representation.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Public Shared Function ToString ( _
	value As Single _
) As String
Dim value As Single
Dim returnValue As String

returnValue = Convert.ToString(value)
public static String ToString (
	float value
public static function ToString (
	value : float
) : String



A single-precision floating point number.

Return Value

The String equivalent of the value of value.

This implementation is identical to Single.ToString.

The following code sample illustrates the conversion of a Single to a String, using ToString.

Public Sub ConvertStringFloat(ByVal stringVal As String)
    Dim singleVal As Single = 0

        singleVal = System.Convert.ToSingle(singleVal)
        System.Console.WriteLine("The string as a single is {0}.", _
    Catch exception As System.OverflowException
        System.Console.WriteLine( _
            "Overflow in string-to-single conversion.")
    Catch exception As System.FormatException
        System.Console.WriteLine( _
            "The string is not formatted as a Single.")
    Catch exception As System.ArgumentException
        System.Console.WriteLine("The string is null.")
    End Try

    ' Single to string conversion will not overflow.
    stringVal = System.Convert.ToString(singleVal)
    System.Console.WriteLine("The single as a string is {0}.", _
End Sub

public void ConvertStringFloat(String stringVal)
    float floatVal = 0;

    try {        
        floatVal = System.Convert.ToSingle(stringVal);
        System.Console.WriteLine("The string as a float is {0}.", 
    catch (System.OverflowException exp) {        
            "The conversion from string-to-float overflowed.");
    catch (System.FormatException exp) {                    
        System.Console.WriteLine("The string is not formatted as a float.");
    catch (System.ArgumentNullException exp){        
        System.Console.WriteLine("The string is null.");

    // Float to string conversion will not overflow.
    stringVal = System.Convert.ToString(floatVal);
    System.Console.WriteLine("The float as a string is {0}.", stringVal);
} //ConvertStringFloat

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0