Resources for IT Professionals > Dynamics Forums > GP customization > Getting user response to message box from C#
Ask a questionAsk a question
 

QuestionGetting user response to message box from C#

  • Tuesday, June 02, 2009 2:44 PMRamzyEbeid Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I have this error now: " Specified cast is not valid"


    Concerning Continuum API.

     

     

    I did do my homework but I am facing a very strange error so I need your help.

     

    I build my solution and I add the DLL in this path: C:\Program Files\Microsoft Dynamics\GP\AddIns

     

    Please find hereunder the code I wrote:

     

     

    using System;

    using System.Collections.Generic;

    using System.Text;

    using Microsoft.Dexterity.Bridge;

    using Microsoft.Dexterity.Applications;

     

     

    namespace HowToTestContinuumAPI

    {

        public class GPAddIn : IDexterityAddIn

        {

            // IDexterityAddIn interface

            public static Dynamics.Application GPAPP = new Dynamics.Application();

            public GPCallbackClass GPCallBack = new GPCallbackClass();

            enum focus_type

            {

                PRE = 0, CHANGE, POST, PRINT, ACTIVATE, FILL, INSERT,

                DELETE, MODAL_DIALOG         }

            enum attach_type { Before = 1, After }       

     

            public void Initialize()

            {       

            //Dynamics.DIALOG_RESPONSE

           

            GPAPP.RegisterFocusTrigger("window 'IV_Transaction_Lot_Numbers' of form 'IV_Transaction_Entry'",

                8, 1, GPCallBack, "POP_Lot_Entry_Dialogs");       

     

            }

    GPAPP.SetParamHandler(GPCallBack);

     

     

        }

    }

     

     

     

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

     

     

    using System;

    using System.Collections.Generic;

    using System.Text;

     

    namespace ContinuumAPIProjectCSharp

    {

        public class GPCallbackClass

        {

            public GPCallbackClass()

            {

            }

            public void POP_Lot_Entry_Dialogs(int dialogType, string prompt, ref string

            control1, ref string control2, ref string control3, ref int answer)

            {

                if (dialogType == 0 && prompt == "Are you sure you want to remove all lot numbers?")

                {

                    answer = 0;

                    HowToTestContinuumAPI.GPAddIn.GPAPP.StopProcessing();

                }

            }

        }

    }


    Ramzy