Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ,"&","&") 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 "&" ? – Petr Krebs Apr 6 '12 at 20:32
i did but it prints "&" as if "TEXT & MORE TEXT" – Jakub Apr 6 '12 at 20:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.