closing infopath using c# - InfoPath Dev
in

InfoPath Dev

closing infopath using c#

Last post 08-30-2005 08:26 AM by Sumeet. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-18-2005 07:03 AM

    closing infopath using c#

    I have a couple of questions regarding infopath in conjunction with c# code.

    1. How do u close an infopath form using c# code behind (service pack).

    I tried the following methods that didn't work (mostly security exception or com exceptions):


    using WIN = System.Windows.Forms;

    WIN.Application.Exit();
    WIN.Application.ExitThread();
    thisApplication.ActiveWindow.Close(true);
    thisApplication.ActiveWindow.Close(false);
    thisApplication.Windows[0].Close(true);
    thisApplication.Windows[0].Close(false);
    thisApplication.Windows[1].Close(true);
    thisApplication.Windows[1].Close(false);
    thisApplication.Quit(true);
    thisApplication.Quit(false);


    2. How do u disable submit on a form (not just by disabling a button)

    An answer to these questions would be wonderful (especially the first question).
    Thanks in advance.
  • 08-18-2005 11:54 AM In reply to

    Re: closing infopath using c#

    Hi clochiani, Welcome to the Forum!

    You can use
    thisXDocument.View.Window.Close(true); to close Current InfoPath form.

    Hope this Helps!

    Agni
    InfoPath Dev India
  • 08-30-2005 08:26 AM In reply to

    • Sumeet
    • Not Ranked
    • Joined on 08-25-2005
    • USA
    • Posts 12

    Re: closing infopath using c#

    Hi All,

    I am sorry for changing the post again and again but I want to pin point the error so that anybody helping me would have the correct information. Sorry and Thanks.

    I have to load the form based on whether a condition is met or not. If its not met then I just display an error message and I need to close the form.

    I tried thisXDocument.View.Window.Close(true); and it didn't work. It doesn't bomb out either. It then displays the form.

    All this checking part is in the form_load. Is it possible that since the condition checking is in the form_load the form will be displayed anyhow? If thats the case then what do I do in case I have to display a form only in case a condition is met?

    I have already tried thisApplication.Quit(true); or stuff like thisXDocument.Save(); thisXDocument.Submit(); thinking that it would automatically close the form since there would be no change in the form and thus nothing new to save but still the form opens.

    Any help would be greatly appreciated.

    Thanks in advance

    Sumeet
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.