tolac 4/2/2008 8:55:49 PM

Why error when trying to "RegisterFocusTrigger()"?

 Hi everyone,

I am sorry if post this question in the wrong place.

I am using C#, Continuum to intercept user click buttons in Modal Dialog Window by the following code:

In Main:
Application GpApp;
Type t = Type.GetTypeFromProgID("Dynamics.Application", false);
GpApp = (Application)Activator.CreateInstance(t);
GpApp.RegisterFocusTrigger("window 'PM_Transaction_Entry' of form 'PM_Transaction_Entry", focusType, attachType, new ModalDialogHandler(), "action");

In ModalDialogHandler class:
class ModalDialogHandler
    {
        public void action(int dialog_type, string prompt, string control_1, string control_2, string control_3, int answer)
        {
            System.Console.WriteLine("Answer: " + answer.ToString());
        }
    }

I always get error "Specified cast is not valid." when I run this code.

Thank you in advance, I appreciate all you answers.

Tola 

Version: Unknown or N/A
Section: Visual Studio Tools for Dynamics GP


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3