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.

thanks
deletepricechange.doc
TrialUserAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steve EndowMicrosoft MVP - Dynamics GPCommented:
Hi,

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.

Thanks,

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

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TrialUserAuthor Commented:
Thanks a ton.
0
TrialUserAuthor Commented:
Thanks a ton. Great explanantion and thanks for the code.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Tax / Financial Software

From novice to tech pro — start learning today.