web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Visual Studio C# GP 2010 Capture Action Button Events

(0) ShareShare
ReportReport
Posted on by 75,850 Moderator

Using VS C# and the VS Toolkit for GP 2010, how do you capture events on the Action button of the SOP and POP Transaction Entry screens? I see the Save Button events and the Action Button events but how do you capture the sub-events of the Action Buttons?
?

*This post is locked for comments

I have the same question (0)
  • Josh P Profile Picture
    2,895 on at

    Hi Richard,

    Is this what you are looking for?

    // private class field

    private SopEntryForm sopForm = Dynamics.Forms.SopEntry;

    // in the constructor

    this.sopForm.SopEntry.SaveButton.ClickAfterOriginal +=new EventHandler(SaveButton_ClickAfterOriginal);

    // method to handle after the save button is clicked

    // you could also handle the ClickBeforeOriginal too if you needed to do something like validation

    static void SaveButton_ClickAfterOriginal(object sender, EventArgs e)

    {  

               // do stuff here

    }

    Or are you looking to capture the EventArgs passed through the handler?

    Regards,

    Joshua Pelkola

  • Richard Wheeler Profile Picture
    75,850 Moderator on at

    I am trying to capture the fact that after clicking Actions, I may click Post,Transfer,Copy,Delete or Void. How to I capture clicking those?

  • Verified answer
    Josh P Profile Picture
    2,895 on at

    Hi Richard,

    The individual actions do not have event handlers. You would need to handle the Change event of the action button, and check the value. I would use a switch statement to see which selection was pressed by the user. See the code below:

    // class variable
    private SopEntryForm sopForm = Dynamics.Forms.SopEntry;

    // in the constructor
    sopForm.SopEntry.ActionButton.Change +=new EventHandler(ActionButton_Change);

    // method to handle the ActionButton change event
    private void ActionButton_Change(object sender, EventArgs e)
    {
         switch (sopForm.SopEntry.ActionButton.Value)  // the Value is a short type
         {
              case 1: // delete
                   // TODO handle the delete click here
                    
                   break;
              case 2: // void
                   // TODO handle the void click here
                    
                   break;
              default:
                   break;
         }
    }

    In the switch statement, you can handle the clicks individually, or treat this like an action factory of sorts. You may also subscribe to the Validation events as well instead of the Change event if you want to add some custom validation to the button.

    Thanks,

    Joshua Pelkola

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans