Crash opening a saved form

L

Laurie_Marsh

I have followed the instructions in the "Add Custom Buttons to the Repeating
Table and Section Widget" Tutorial of the InfoPath dev web site - except
that I am using C# managed code behind the form. (see
http://www.infopathdev.com/howto/tutorials/default.aspx?i=f02e8631f1c342df9c49fe8103e10215)

I then create a new form with some data in it and save it to a file.

When I open that saved form using the File Open command in InfoPath,
InfoPath crashes with the "Microsoft Office InfoPath has encountered a
problem and needs to close. We are sorry for the inconvenience." error.

I have narrowed it down to the mere existance of the OnClick event handler
for my added button. Below is my event handler. When it is included in the
solution, InfoPath crashes. If I delete this method and only this method, it
doesn't crash.


[InfoPathEventHandler(MatchPath = "widgetMoveToAccomplished", EventType =
InfoPathEventType.OnClick)]
public void widgetMoveToAccomplished_OnClick(DocActionEvent e)
{
try
{
thisXDocument.UI.Alert("got here");
}
catch (Exception err)
{
thisXDocument.UI.Alert("Error occured: " + err.Message);
}
} // End of widgetMoveToAccomplished_OnClick.


Another piece of interesting information is that if I double-click on the
saved form to open it (instead of using the File Open command), InfoPath will
open the form without crashing and yes, my added button in the repeating
table menu works just fine.

Anyone go any ideas how to work around this crash (other than telling the
users not to use the File Open menu command)??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top