daveesc

Update annotation text

Discussion created by daveesc on Sep 30, 2011
Latest reply on Oct 1, 2011 by daveesc
Hi,

I'm trying to change the text string in a existing annotation. In the debugger, I can see the text change take place but I log out and back in and the original text string is still present. When I uncomment the line "'pAnnotationFeature.Store()", I get an null pointer error. My code looks like this:
        pWorkspaceEdit.StartEditing(True)
...
        pStreamCursor = pFCStream.Search(pStreamQueryFilter, False)
        pStreamFeature = pStreamCursor.NextFeature
        While Not (pStreamFeature Is Nothing)
            pAnnotationUpdateFilter = New QueryFilter
            pAnnotationUpdateFilter.WhereClause = "Unique_ID=" & pStreamFeature.Value(indexAnnotationFeatureField)
            pFCursor = pFC.Update(pAnnotationUpdateFilter, False)
            pAnnotationFeature = pFCursor.NextFeature
            While Not (pAnnotationFeature Is Nothing)
                pTextElement = CType(pAnnotationFeature.Annotation, ISymbolCollectionElement)
                length = pStreamFeature.Value(indexLengthField)
                pTextElement.Text = "Hello"
                'pAnnotationFeature.Store()
                pAnnotationFeature = pFCursor.NextFeature
            End While
            pStreamFeature = pStreamCursor.NextFeature

        End While
        pWorkspaceEdit.StopEditing(True)


Can anyone help?

Outcomes