Deleting a row event ITemPriceListmaintenance window

When the user clicks on a Delete Row in the tool bar in the ItemPriceList Maintenance window to delete a record from the Item PriceList maintenance window, I would like to trap that event. Which event is this? How do I trap this event? Please help. I have also attached a screen shot of the Window I am talking about.

Who is Participating?
Steve EndowMicrosoft MVP - Dynamics GPCommented:

Depending on the information that you need from the deleted price list record, you have two events you can use on the PriceListScroll object:
  1. LineDeleteBeforeOriginal
  2. LineDeleteAfterOriginal
The Before event allows you to see the values of the record before it is deleted.  The After event is only a generic event letting you know only that a record was deleted--you will not be able to get the field values for the deleted line.

Code sample attached.


Steve Endow
Dynamics GP Certified Trainer
Dynamics GP Certified Professional

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Microsoft.Dexterity.Bridge;
using Microsoft.Dexterity.Applications;
using Microsoft.Dexterity.Applications.DynamicsDictionary;

namespace GPAddInSample
    public class GPAddIn : IDexterityAddIn

        // Create variables for the form and window that will be referenced
        IvItemPriceListMntForm PriceListForm;
        IvItemPriceListMntForm.IvItemPriceListMntWindow PriceListWindow;
        IvItemPriceListMntForm.PriceListScrollScrollingWindow PriceListScroll;

        // IDexterityAddIn interface
        public void Initialize()
            PriceListForm = Dynamics.Forms.IvItemPriceListMnt;
            PriceListWindow = PriceListForm.IvItemPriceListMnt;
            PriceListScroll = PriceListWindow.PriceListScroll;

            //Event immediately before record is deleted
            PriceListScroll.LineDeleteBeforeOriginal += new System.ComponentModel.CancelEventHandler(PriceListScroll_LineDeleteBeforeOriginal);
            //Event immediately after record is deleted
            PriceListScroll.LineDeleteAfterOriginal += new EventHandler(PriceListScroll_LineDeleteAfterOriginal);   

        void PriceListScroll_LineDeleteBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e)
            string priceLevel = PriceListScroll.PriceLevel.Value;
            string uom = PriceListScroll.UOfM.Value;
            decimal fromQty = PriceListScroll.FromQty.Value;
            decimal toQty = PriceListScroll.ToQty.Value;
            decimal unitPrice = PriceListScroll.UnitPrice.Value;
            MessageBox.Show("Line for Price Level " + priceLevel + ", Qty " + fromQty + " to " + toQty + ", Price " + unitPrice + " is about to be deleted");

        void PriceListScroll_LineDeleteAfterOriginal(object sender, EventArgs e)
            string priceLevel = PriceListScroll.PriceLevel.Value;
            MessageBox.Show("Line for Price Level " + priceLevel + " was deleted");

Open in new window

TrialUserAuthor Commented:
Thanks a ton.
TrialUserAuthor Commented:
Thanks a ton. Great explanantion and thanks for the code.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.