Hi everyone, I need your help.
I transferred code for the plug-in developed using Visual Studio tools for GP10 to GP2010 and almost all code works fine, but I have a problem with handling PostButton click events on RmCashReceipts form (Dynamics.Forms.RmCashReceipts.RmCashReceipts.PostButton.ClickBeforeOriginal and Dynamics.Forms.RmCashReceipts.RmCashReceipts.PostButton.ClickAfterOriginal).
It looks like API does not fire this events. It’s very strange, because other handlers for this form work fine (Save button click events, Open form events, etc.). I also tried to hide PostButton (Dynamics.Forms.RmCashReceipts.RmCashReceipts.PostButton.Hide()) and PostButton on CashReceipts form disappeared.
I downloaded and tried Visual Studio tools for GP2010, but got the same results - nothing in errors output, but PostButton events handlers do not work.
Here is my code:
Code:
public void Initialize()
{
//Post button handlers Dynamics.Forms.RmCashReceipts.RmCashReceipts.DeleteButton.ClickBeforeOriginal += new CancelEventHandler(DeleteButtonClickBeforeOrignal);
Dynamics.Forms.RmCashReceipts.RmCashReceipts.DeleteButton.ClickAfterOriginal += new EventHandler(DeleteButtonClickAfterOrignal);
//Save button handlers
Dynamics.Forms.RmCashReceipts.RmCashReceipts.SaveButton.ClickBeforeOriginal += new CancelEventHandler(SaveButtonClickBeforeOrignal);
Dynamics.Forms.RmCashReceipts.RmCashReceipts.SaveButton.ClickAfterOriginal += new EventHandler(SaveButtonClickAfterOrignal);
//Open form handlers
Dynamics.Forms.RmCashReceipts.RmCashReceipts.OpenBeforeOriginal += new CancelEventHandler(FormOpenBeforeOrignal);
Dynamics.Forms.RmCashReceipts.RmCashReceipts.OpenAfterOriginal += new EventHandler(FormOpenAfterAfterOrignal);
}
public void PostButtonClickBeforeOrignal(object sender, CancelEventArgs e)
{
MessageBox.Show("PostButtonClickBeforeOrignal");
}
public void PostButtonClickAfterOrignal(object sender, EventArgs e)
{
MessageBox.Show("PostButtonClickAfterOrignal");
}
public void SaveButtonClickBeforeOrignal(object sender, CancelEventArgs e)
{
MessageBox.Show("SaveButtonClickBeforeOrignal");
}
public void SaveButtonClickAfterOrignal(object sender, EventArgs e)
{
MessageBox.Show("SaveButtonClickAfterOrignal");
}
public void FormOpenBeforeOrignal(object sender, CancelEventArgs e)
{
MessageBox.Show("FormOpenBeforeOrignal");
}
public void FormOpenAfterAfterOrignal(object sender, EventArgs e)
{
MessageBox.Show("FormOpenAfterAfterOrignal");
}
Update2:
Hi Vikas,
Thanks for the response.
I reinstalled the environment (GP2010 + GP2010 VS Tools) and got the same result - post button click handlers do not work and no exceptions are generated (please see the code below).
During the previous attempt I used GP2010 (11.00.1752 SP2) + VS2005 + GP10 VS Tools, currently I use the same GP2010 version + VS2010 + GP2010 VS Tools.
Could anyone please check this code with GP2010(GP11)? Any other ideas are appreciated. Here is my code (save button handlers work properly, but post button click handlers do not work):
public void Initialize()
{
try
{
MessageBox.Show("Init event");
//post button register handlers
Dynamics.Forms.RmCashReceipts.RmCashReceipts.PostButton.ClickBeforeOriginal += new CancelEventHandler(PostButtonClickBeforeOrignal);
Dynamics.Forms.RmCashReceipts.RmCashReceipts.PostButton.ClickAfterOriginal += new EventHandler(PostButtonClickAfterOrignal);
//save button register handlers
Dynamics.Forms.RmCashReceipts.RmCashReceipts.SaveButton.ClickBeforeOriginal += new CancelEventHandler(SaveButtonClickBeforeOrignal);
Dynamics.Forms.RmCashReceipts.RmCashReceipts.SaveButton.ClickAfterOriginal += new EventHandler(SaveButtonClickAfterOrignal);
}
catch (Exception exc)
{
MessageBox.Show(String.Format("Exception: {0}", exc.Message));
}
}
public static void PostButtonClickBeforeOrignal(object sender, CancelEventArgs e)
{
try
{
MessageBox.Show("Post button click before orignal");
}
catch (Exception exc)
{
MessageBox.Show(String.Format("Exception: {0}", exc.Message));
}
}
public static void PostButtonClickAfterOrignal(object sender, EventArgs e)
{
try
{
MessageBox.Show("Post button click after orignal");
}
catch (Exception exc)
{
MessageBox.Show(String.Format("Exception: {0}", exc.Message));
}
}
public static void SaveButtonClickBeforeOrignal(object sender, CancelEventArgs e)
{
try
{
MessageBox.Show("Save button click before orignal");
}
catch (Exception exc)
{
MessageBox.Show(String.Format("Exception: {0}", exc.Message));
}
}
public static void SaveButtonClickAfterOrignal(object sender, EventArgs e)
{
try
{
MessageBox.Show("Save button click after orignal");
}
catch (Exception exc)
{
MessageBox.Show(String.Format("Exception: {0}", exc.Message));
}
}
Thanks,
Dmitry Kutetsky.
*This post is locked for comments