This document is archived and information here might be outdated.  Recommended version.


IARUnitConverter.ConvertUnits Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (PublisherControls)  

IARUnitConverter.ConvertUnits Method

Converts the specified value between two units of measure.

[Visual Basic .NET]
Public Function ConvertUnits ( _
    ByVal dValue As Double, _
    ByVal inUnits As esriARUnits, _
    ByVal outUnits As esriARUnits _
) As Double
[C#]
public double ConvertUnits (
    double dValue,
    esriARUnits inUnits,
    esriARUnits outUnits
);

Product Availability

Available with ArcGIS Desktop. Requires Publisher Extension.

Description

Converts the specfied value from one unit of measure to another unit of measure. For example, the method could convert the height and width of the page layout from its present page units into centimetres.

Errors Returned

2122 800A084A: The specified enum value is invalid 

[C#]
IARUnitConverter unitConverter=axArcReaderControl1.ARUnitConverter;
double d;
//Returns 0.1005 
d=unitConverter.ConvertUnits(100.5, esriARUnits.esriARUnitsMeters, esriARUnits.esriARUnitsKilometers);
//Returns 10050 
d=unitConverter.ConvertUnits(100.5, esriARUnits.esriARUnitsMeters, esriARUnits.esriARUnitsCentimeters);
[Visual Basic .NET]
Dim pUnitConverter As IARUnitConverter
pUnitConverter=AxArcReaderControl1.ARUnitConverter
Dim d As Double
'Returns 0.1005 
d=pUnitConverter.ConvertUnits(100.5, esriARUnits.esriARUnitsMeters, esriARUnits.esriARUnitsKilometers)
'Returns 10050 
d=pUnitConverter.ConvertUnits(100.5, esriARUnits.esriARUnitsMeters, esriARUnits.esriARUnitsCentimeters)

See Also

IARUnitConverter Interface