AnsweredAssumed Answered

ArcObjects - Error in cast an IGeometry object

Question asked by shaningesri on Oct 27, 2014
Latest reply on Oct 27, 2014 by shaningesri

Referring to the code at

' http://stackoverflow.com/questions/9212398/how-to-determine-whether-a-geometry-is-multi-part

static bool IsMultiPart(this IGeometry geometry{
  
var geometryCollection = geometry as IGeometryCollection;
  
return geometryCollection != null && geometryCollection.GeometryCount > 1;
}

 

I wrote a piece of VBA as below, but got a compiling error (Sub or Function not defined) at the line as highlighted below.  What's wrong in this piece of code?  Appreciate if you can point out.

Function IsMultiPart(geo As IGeometry)

    Dim b As Boolean

    Dim geometryCollection As IGeometryCollection

    Set geometryCollection = CType(geo, IGeometryCollection)

    If geometryCollection <> Null And geometryCollection.GeometryCount > 1 Then

        b = True

    Else

        b = False

    End If

    IsMultiPart = b

End Function

Outcomes