none
Content Control Exit events not firing RRS feed

  • Question

  • Hello,

    I have a document level VSTO application.

    In my development environment (Office 2007 Pro, Visual Studio 2010, .NET 4.0 on Windows 7 64 bit), I have RichTextContentcontrols that exist statically and that are added dynamically where I subscribe to each control's exit event.  This works just fine.

    On the QA machine I deploy to(Office 2007 pro, .NET 4.0 Windows XP SP2), the static RichTextContentControls exit events never fire but the exit events for the dynamically added RichTextContentControls do fire.

    I then tested the enter event for static richtextcontrols and these too fire just fine on both the dev and the QA machines.

    Does anyone know why the static RichTextContentControl exit events do not fire?

    Any help would be appreciated.


    Steve
    Wednesday, March 9, 2011 9:54 PM

Answers

  • I have discovered the problem. If you ever have static content controls within a table, do NOT ever delete that table programmatically.  If you try to delete static content controls programmatically, it will throw an exception telling you that you aren't allowed to do that but it doesn't throw an exception if you delete the static contnt controls indirectly like I did.  Here is what happened as a result.

    1. The ContentControl.Range.InsertXML wasn't functioning properly.

    2. Exit and Enter events for ContentControls stopped firing.

     

    I hope this helps anyone down the road.


    Steve
    Thursday, March 10, 2011 9:54 PM

All replies

  • I have made another discovery.  I was dynamically subscribing to the exit event so the events weren't being subscribed to in the internalstartup method.  As soon as I moved the subscriptions there, they astarted firing.  I still dont know why it worked n one machine and not the other.

    Steve


    Steve
    Wednesday, March 9, 2011 10:52 PM
  • I have discovered the problem. If you ever have static content controls within a table, do NOT ever delete that table programmatically.  If you try to delete static content controls programmatically, it will throw an exception telling you that you aren't allowed to do that but it doesn't throw an exception if you delete the static contnt controls indirectly like I did.  Here is what happened as a result.

    1. The ContentControl.Range.InsertXML wasn't functioning properly.

    2. Exit and Enter events for ContentControls stopped firing.

     

    I hope this helps anyone down the road.


    Steve
    Thursday, March 10, 2011 9:54 PM