Hi Stanley,
Can you drop a New button on your form and use the following code:
thisApplication.ActiveWindow.Close(true);
Does it help?
Where are you calling your code from? This might be your issue. For
example if you call it from the OnLoad event, you would experience issues
such as the one that you describe.
Regards,
Franck Dauché
> Hi,
> i am trying to close infopath in manage code but get these errors:
[quoted text clipped - 22 lines]
>
> Stanley
Stanley - 25 Oct 2005 08:35 GMT
Franck,
I am calling the quit() from the onload event indeed. When i do it through a
button it works. Your correct.
What i am trying to achieve is when opening the form i do some validation,
if the validation turns out negative, the form has to be closed. Is this
(even) possible?
Thnx,
Stanley
> Hi Stanley,
>
[quoted text clipped - 37 lines]
> >
> > Stanley
Stanley - 25 Oct 2005 08:50 GMT
I noticed that lots of code doesn't work in the onload event. I would like to
try switching view in the onload event instead of closing the form. But that
than gives an object reference error.
> Franck,
> I am calling the quit() from the onload event indeed. When i do it through a
[quoted text clipped - 47 lines]
> > >
> > > Stanley
Franck Dauché - 25 Oct 2005 15:04 GMT
Hi Stanley,
OnLoad, use:
thisXDocument.ViewInfos["YouViewName"].IsDefault = true;
Switching to a different View at first is a good technique. If the user
credentials are OK, switch back to your main View, otherwise, close InfoPath.
Hope that it helps.
Regards,
Franck Dauché
> I noticed that lots of code doesn't work in the onload event. I would like to
> try switching view in the onload event instead of closing the form. But that
[quoted text clipped - 51 lines]
> > > >
> > > > Stanley