Frequently asked question
Code:
... Setup pFeature as IFeature ...
... Setup pFC as IFeatureClass for esriGeometryPolygon ...
Dim strShapeFieldName As String
Dim strLengthFieldName As String
Dim strAreaFieldName As String
strShapeFieldName = pFC.ShapeFieldName
strAreaFieldName = pFC.AreaField.Name
strLengthFieldName = pFC.LengthField.Name
Dim pArea As IArea
Dim pPolygon As IPolygon
Set pArea = pFeature.Shape
Set pPolygon = pFeature.Shape
MsgBox "These may be zero: " & vbNewLine _
& " Area: " & pFeature.Value(pFeature.Fields.FindField(strAreaFieldName)) & vbNewLine _
& " Length: " & pFeature.Value(pFeature.Fields.FindField(strLengthFieldName))
MsgBox "These will never be zero: " & vbNewLine _
& " Area: " & pArea.Area & vbNewLine _
& " Length: " & pPolygon.length
Get help from ArcGIS experts
Download the Esri Support App