<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: closing infopath using c#</title><link>https://www.infopathdev.com:443/forums/thread/13468.aspx</link><pubDate>Tue, 30 Aug 2005 15:26:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13468</guid><dc:creator>Sumeet</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13468.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13468</wfw:commentRss><description>Hi All,&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;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. &lt;br /&gt;&lt;br /&gt;I tried thisXDocument.View.Window.Close(true); and it didn't work. It doesn't bomb out either. It then displays the form. &lt;br /&gt;&lt;br /&gt;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?&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;Any help would be greatly appreciated.&lt;br /&gt;&lt;br /&gt;Thanks in advance&lt;br /&gt;&lt;br /&gt;Sumeet&lt;br /&gt;</description></item><item><title>Re: closing infopath using c#</title><link>https://www.infopathdev.com:443/forums/thread/13467.aspx</link><pubDate>Thu, 18 Aug 2005 18:54:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13467</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13467.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13467</wfw:commentRss><description>Hi clochiani, Welcome to the Forum!&lt;br /&gt;&lt;br /&gt;You can use &lt;br /&gt;thisXDocument.View.Window.Close(true); to close Current InfoPath form.&lt;br /&gt;&lt;br /&gt;Hope this Helps!&lt;br /&gt;&lt;br /&gt;Agni&lt;br /&gt;InfoPath Dev India</description></item><item><title>closing infopath using c#</title><link>https://www.infopathdev.com:443/forums/thread/12529.aspx</link><pubDate>Thu, 18 Aug 2005 14:03:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12529</guid><dc:creator>clochiani</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12529.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12529</wfw:commentRss><description>I have a couple of questions regarding infopath in conjunction with c# code.&lt;br /&gt;&lt;br /&gt;1. How do u close an infopath form using c# code behind (service pack).&lt;br /&gt;&lt;br /&gt;I tried the following methods that didn't work (mostly security exception or com exceptions):&lt;br /&gt;&lt;br /&gt;&lt;font size="1"&gt;&lt;br /&gt;using WIN = System.Windows.Forms;&lt;br /&gt;&lt;br /&gt;WIN.Application.Exit();&lt;br /&gt;WIN.Application.ExitThread();&lt;br /&gt;thisApplication.ActiveWindow.Close(true);&lt;br /&gt;thisApplication.ActiveWindow.Close(false);&lt;br /&gt;thisApplication.Windows[0].Close(true);&lt;br /&gt;thisApplication.Windows[0].Close(false);&lt;br /&gt;thisApplication.Windows[1].Close(true);&lt;br /&gt;thisApplication.Windows[1].Close(false);&lt;br /&gt;thisApplication.Quit(true);&lt;br /&gt;thisApplication.Quit(false);&lt;/font id="size1"&gt;&lt;br /&gt;&lt;br /&gt;2. How do u disable submit on a form (not just by disabling a button)&lt;br /&gt;&lt;br /&gt;An answer to these questions would be wonderful (especially the first question).&lt;br /&gt;Thanks in advance.</description></item></channel></rss>