I have followed the instructions in the "Add Custom Buttons to the Repeating
Table and Section Widget" Tutorial - except that I am using C# managed code
behind the form. (see
http://www.infopathdev.com/howto/tutorials/default.aspx?i=f02e8631f1c342df9c49fe
8103e10215)
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)??
Adam Harding - 09 Oct 2006 11:35 GMT
Laurie
I have been working with Infopath for about 18 months and don't code but i
believe i might know the source of the problem. Double-clicking the icon to
open it cross references the icon with the reference on your desktop which
has the control in which holds a design view that has your add button
included. Clicking file open in Infopath does not reference the saved
version on your hard drvie so confusing reference.
It sounds as if the managed code isn't linking back through to the generic
template properly rending it inoperable through the form open command. have
you re-split the form templte files and then recombined them properly as this
could be a source of your error. Right-clik on your edited .XSF in explorer
select design and republish, if this is your problem this should sort it.
Cheers Adam
> I have followed the instructions in the "Add Custom Buttons to the Repeating
> Table and Section Widget" Tutorial - except that I am using C# managed code
[quoted text clipped - 33 lines]
> Anyone go any ideas how to work around this crash (other than telling the
> users not to use the File Open menu command)??
Laurie_Marsh - 09 Oct 2006 13:18 GMT
Hi Adam,
Thanks for trying to help with my problem. I really appreciate it. I
followed your suggestion but it did not fix the problem. Any other ideas?
Laurie
> Laurie
>
[quoted text clipped - 50 lines]
> > Anyone go any ideas how to work around this crash (other than telling the
> > users not to use the File Open menu command)??