InfoPath 2007: programmatically close infopath form

J

Jane

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
 
S

steve

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

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
 
J

Jane

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.
 

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