I follow the esri example for validating topology, is it possible to tell whether topology error exists? The code I use:

    ' Step 1 - access a topology
    Dim topoUiD As UID = New UIDClass
    topoUiD.Value = "esriEditorExt.TopologyExtension"
    Dim m_application As IApplication = My.ArcMap.Application
    Dim topologyExt As ITopologyExtension = CType(m_application.FindExtensionByCLSID(topoUiD), ITopologyExtension)  'original code from esri
    Dim topology As ITopology

    topology = CType(topologyExt.CurrentTopology, ITopology)
    MsgBox("successfully access current topology")

    ' Step 2 - Finding topology errors
    Dim geoDS As IGeoDataset = CType(topology, IGeoDataset)
    Dim errorContainer As IErrorFeatureContainer = CType(topology, IErrorFeatureContainer)
    Dim eErrorFeat As IEnumTopologyErrorFeature
    eErrorFeat = errorContainer.ErrorFeaturesByRuleType(geoDS.SpatialReference, esriTopologyRuleType.esriTRTLineCoveredByLineClass, Nothing, True, False)
    Dim topoError As ITopologyErrorFeature

    ' check the eErrorFeat length to determine whether has error
    topoError = eErrorFeat.Next
    MsgBox("check topology errors.")

I am using vs 2012 and arcmap 10.2.

1 Answer 1


When this line of code executes:

topoError = eErrorFeat.Next

topoError will get set to Nothing if there are no errors. This would tell you that no errors existed, so you could use logic something like:

If topoError = Nothing Then
    ' No errors, skip processing
    ' At least one error exists do something...
End If
  • Hi Hornbydd, thanks a lot, have already updated my code. But I find a strange thing of my vb.net arcobjects validate topology function. Since it is another question, I will open a new question.
    – ppLily
    Sep 5, 2014 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.