none
Using AddAdvise method for insertion and deletion of a row in the shape sheet (Visio 2013) RRS feed

  • Question

  • I need an event which can notify me about insertion and deletion of a row in the shape sheet of any shape in Visio 2013. As Visio doesn't provide one so I am trying to create one using EventList.AddAdvise Method (Visio). Here is my code:

    /* clsEventSink is class that implements the IVisEventProc interface */
    clsEventSink sinkObj = new clsEventSink();
    
    /* Here doc = Visio.Document object */
    Visio.EventList evtList = doc.EventList;
    
    evtList.AddAdvise(unchecked((short)Visio.VisEventCodes.visEvtRow + (short)Visio.VisEventCodes.visEvtAdd), sinkObj, "", "Row Added.");

    But the code is throwing an exception with this message: "An exception occurred."

    While I also tried to use AddAdvise method with three other event codes (as shown in code below), which are working fine:

    /* clsEventSink is class that implements the IVisEventProc interface */
    clsEventSink sinkObj = new clsEventSink();
    
    /* Here doc = Visio.Document object */
    Visio.EventList evtList = doc.EventList;
    
    evtList.AddAdvise((short)Visio.VisEventCodes.visEvtCodeDocSave, sinkObj, "", "Document Saved.");
    
    evtList.AddAdvise((short)Visio.VisEventCodes.visEvtCodeShapeDelete, sinkObj, "", "Shape Deleted.");
    
    evtList.AddAdvise(unchecked((short)Visio.VisEventCodes.visEvtPage + (short)Visio.VisEventCodes.visEvtAdd), sinkObj, "", "Page Added.");

    Can anyone suggests anything about this issue?

    Thanks in advance!

    Tuesday, January 10, 2017 7:02 AM

All replies

  • Hi,

    In EventList.AddAdvise Method (Visio), you could find:

    Event constants are declared by the Visio type library and are prefixed with visEvt. To find an event code for the event you want to create, see Event codes.

    visEvtRow + visEvtAdd is not optional according to Event Codes (Visio).

    So I think we are unable to create an event for row adding.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, January 11, 2017 9:17 AM
    Moderator