Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / October 2005

Tip: Looking for answers? Try searching our database.

How hard can it be to close infopath

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stanley - 24 Oct 2005 16:56 GMT
Hi,
i am trying to close infopath in manage code but get these errors:
- object or reference not set
- security error
- The form was not found in the Xdocuments collection
- Invalid context for OM Call
- etc etc...

I've tried these codes:
- thisApplication.XDocuments.Close(thisXDocument);
- thisApplication.Quit(false);
- thisApplication.ActiveWindow.Close(false);
- thisApplication.ActiveWindow.XDocument.View.Window.Close(false)
- etc etc... every possible combination

And none of them won't close the form. Why is it so hard to just close a
simple form? Can somebody help me out? I've looked throughout the whole group
already.

I have some old forms where i use js script and there it works fine, but
when using .NET code it doesn't work anymore. It goes for lots of other
things by the way.

Regards,

Stanley
Franck Dauché - 24 Oct 2005 17:06 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.