Take the 2-minute tour ×

I have a bit of an issue with my addin which converts annotations (text) to polygons. To do this I use the ITextSymbol obtained from the Annotation Feature which is then implemented by the IQueryGeometry interface.

The actual conversion then occurs on this line:

pPolygon = pTextQuery.GetGeometry(pScreenDisplay.WindowDC, pDisplayTransform, pTextPointGeo)

All works good but I noticed it crashes on text strings that contain more then one instance of the ampersand symbol. (chr(38) I understand that this is a special character used for concatenation and such but I would like to retain it as a part of the string. I know how to test whether the string contains the ampersand but what should I do to retain the ampersands without crashing the IQueryGeometry interface?

In label expressions when I often encounter a similar issue I use FindLabel = Replace(FindLabel ,"&","&amp;") to remedy this. However when I try this in Visual Studio it still crashes the iQueryGeometry. Strings that contain only one ampersand pass but strings with more then one ampersands crash. By default REPLACE replaces all searched instances so I don't know what's going on here.

share|improve this question
Have you tried replacing "&" with "&amp;" ? –  Petr Krebs Apr 6 '12 at 20:32
i did but it prints "&amp;" as if "TEXT &amp; MORE TEXT" –  Jakub Apr 6 '12 at 20:39

Your Answer



Browse other questions tagged or ask your own question.