How to close a form? - InfoPath Dev
in

InfoPath Dev

How to close a form?

Last post 03-27-2005 03:58 PM by Shanthi Reddy. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 03-01-2005 01:06 AM

    How to close a form?

    I have an InfoPath form (.NET infoPath project) that contain a field that contain OnAfterChange(DataDOMEvent e) event.
    I this function I have a Confirm massege (In C#):

    if (this.thisXDocument.UI.Confirm("bla bla", XdConfirmButtons.xdOKCancel) == XdConfirmChoice.xdCancel )

    I want that click on Cancel will close the form!!!!
    How to to it??
  • 03-01-2005 09:28 AM In reply to

    You would use:

    thisXDocument.View.Window.Close(true);

    Boolean Parameter:
    true = don't show a dialog box asking if the user wants to close.
    false = show the dialog box.

    Greg Collins [InfoPath MVP]
  • 03-01-2005 10:08 PM In reply to

    I tried it but I get this Error massege:

    System.Runtime.InteropServices.COMException
    Invalid context for OM call.


    What is the problem? Can I close a form in OnAfterChange event?
  • 03-09-2005 12:34 AM In reply to

    Try using an OnClick event handler and see if that works. Not sure why OnAfterChange wouldn't work, but it's possible it's because the DOM hasn't been updated.
    Patrick Halstead
    Project Manager at Qdabra
  • 03-17-2005 06:26 PM In reply to

    i saw this tips and used it for my own "Close Form" button that will both save the entries and close the form using custom code.

    (onClick event)
    XDocument.View.Window.Close(false);

    my question is, can we specify a custom filename to save when this event occurs? (by default it will be saved as "Form<number>" in my sharepoint library.
  • 03-27-2005 03:58 PM In reply to

    You can use something like this is your custom code right before closing the window.

    DAVAdapter oSharePoint = (DAVAdapter)thisXDocument.DataAdapters["SharepointSubmit"];
    oSharePoint.FileName = sSharePointFileName;

    Shanthi
    InfoPathDev India
    Shanthi Reddy
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.