Home  |  Delphi .net Home  |  System.Convert  |  ToUInt16 Method
  
ToUInt16  
Method  
Converts data from one data type to a UInt16 data type
Convert Class
System NameSpace
CF1.  Function ToUInt16 ( Value : Boolean ) : UInt16; Static;
CF2.  Function ToUInt16 ( Value : Byte ) : UInt16; Static;
CF3.  Function ToUInt16 ( Value : Char ) : UInt16; Static;
CF4.  Function ToUInt16 ( Value : DateTime ) : UInt16; Static;
CF5.  Function ToUInt16 ( Value : SmallInt ) : UInt16; Static;
CF6.  Function ToUInt16 ( Value : ShortInt ) : UInt16; Static;
CF7.  Function ToUInt16 ( Value : Integer ) : UInt16; Static;
CF8.  Function ToUInt16 ( Value : Int64 ) : UInt16; Static;
CF9.  Function ToUInt16 ( Value : UInt64 ) : UInt16; Static;
CF10.  Function ToUInt16 ( Value : Word ) : UInt16; Static;
CF11.  Function ToUInt16 ( Value : Single ) : UInt16; Static;
CF12.  Function ToUInt16 ( Value : Double ) : UInt16; Static;
CF13.  Function ToUInt16 ( Value : Decimal ) : UInt16; Static;
CF14.  Function ToUInt16 ( Value : UInt16 ) : UInt16; Static;
CF15.  Function ToUInt16 ( Value : String ) : UInt16; Static;
CF16.  Function ToUInt16 ( Value : String; FormatProvider : IFormatProvider ) : UInt16; Static;
CF17.  Function ToUInt16 ( Value : Object ) : UInt16; Static;
CF18.  Function ToUInt16 ( Value : Object; FormatProvider : IFormatProvider ) : UInt16; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Attempts to transfer the value from one of the given Value data types to UInt16.
 
The optional FormatProvider parameter determines the parsing rules and is beyond the scope of this article.
Notes
An exception is thrown if the conversion fails.
Microsoft MSDN Links
System
System.Convert
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  value : UInt16;
  myStr : String;

begin
  myStr  := '12345';

  value  := System.Convert.ToUInt16(myStr);

  Console.WriteLine(value.ToString);

  Console.ReadLine;
end.
   12345
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author