How to close a form? - InfoPath Dev Sign in | Join | Help in General InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » General » How to close a form? 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: Oldest to newest Newest to oldest Previous Next 03-01-2005 01:06 AM liorlankri Joined on 02-27-2005 Posts 205 How to close a form? Reply Contact 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 Greg Collins Joined on 08-08-2006 Posts 2,126 Re: How to close a form? Mark as Not AnswerMark as Answer... Reply Contact 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] Please Visit:BraintroveGreg's Paintings 03-01-2005 10:08 PM In reply to liorlankri Joined on 02-27-2005 Posts 205 Re: How to close a form? Mark as Not AnswerMark as Answer... Reply Contact I tried it but I get this Error massege:System.Runtime.InteropServices.COMExceptionInvalid 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 Patrick Halstead Joined on 08-08-2006 Posts 5,112 Re: How to close a form? Mark as Not AnswerMark as Answer... Reply Contact 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 HalsteadProject Manager at Qdabra 03-17-2005 06:26 PM In reply to potpourri Joined on 03-10-2005 Posts 62 Re: How to close a form? Mark as Not AnswerMark as Answer... Reply Contact 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 Shanthi Reddy Joined on 08-21-2006 Posts 144 Re: How to close a form? Mark as Not AnswerMark as Answer... Reply Contact You can use something like this is your custom code right before closing the window.DAVAdapter oSharePoint = (DAVAdapter)thisXDocument.DataAdapters["SharepointSubmit"];oSharePoint.FileName = sSharePointFileName;ShanthiInfoPathDev India Shanthi Reddy Page 1 of 1 (6 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.