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 / May 2007

Tip: Looking for answers? Try searching our database.

InfoPath 2007: programmatically close infopath form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jane - 07 May 2007 22:11 GMT
Hi,

I know this is a silly question but I just cannot find the answer anywhere
on the internet.  I have a form (which is also web-browser enabled) with an
Approve button.  When the user clicks on the Approver button, it will execute
my code behind.  I would like the form to also programmatically close after
the code is executed.  Is there a method or sample that demonstrates how I
can close an InfoPath 2007 form programmatically?

I tried the ExternalApplication.close() method but it does not show up
(meaning intellisense) in my form.  If I use the "Close the form" action in
the Rules button, my code is never executed.  

Please advice.

Thanks
Jane
steve - 09 May 2007 10:35 GMT
> Hi,
>
[quoted text clipped - 13 lines]
> Thanks
> Jane

if your using Visual Studio/VB.............  i'm using 2003, but it
probably works the same.

 Public Class InfoPathProject2
// these will probably already be defined in your project
       Private thisXDocument As XDocument
       Private thisApplication As Application
......

then behind your button....

thisApplication.ActiveWindow.Close(True)

hope this helps..................

steve
Jane - 09 May 2007 17:40 GMT
Hi Steve,

Thanks for the quick response.  Unfortunately, since we have to use the form
services (so our users don't have to install the InfoPath software), the code
you provided does not work.  It works if I did not turn my form to
web-browser enabled in the form options.  

The funny thing is that it works in InfoPath 2003 but not InfoPath 2007.  
Thanks you so much for your help!  The workaround I used was to switch to
different form views.

> Hi,
>
[quoted text clipped - 13 lines]
> Thanks
> Jane
 
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.