<?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: Button for saving, and code that goes with it...</title><link>https://www.infopathdev.com:443/forums/thread/29591.aspx</link><pubDate>Sun, 22 Jun 2008 04:16:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:29591</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/29591.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=29591</wfw:commentRss><description>&lt;p&gt;Hello:&lt;/p&gt;
&lt;p&gt;If you haven&amp;#39;t already set your preferred code language for the form, you may want to do that first (in InfoPath 2007, go to Tools, Form Options, Programming). After you add your button to your form, double click it, and give it a Label and a meaningful ID. Then select the Edit Form Code button. VSTA will open and you can add code to the event handler for the button. In C#, the following line will save a form locally, with the name TestForm.xml:&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.SaveAs(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;C:\\TestForm.xml&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;You will probably want to add some error handling, and it would make sense to give your forms a name that will be unique, so that you aren&amp;#39;t overwriting the previously saved form with your new one (unless that is your desired effect). For more information on the XmlForm.SaveAs method, see this link: &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.xmlform.saveas.aspx"&gt;http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.xmlform.saveas.aspx&lt;/a&gt;&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Button for saving, and code that goes with it...</title><link>https://www.infopathdev.com:443/forums/thread/29313.aspx</link><pubDate>Wed, 11 Jun 2008 13:37:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:29313</guid><dc:creator>gsempcb</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/29313.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=29313</wfw:commentRss><description>&lt;p&gt;..I&amp;#39;m making a form, and I would like to have a button that would allow me to save the form locally, after it is filled out. What would be the code/procedure/attributes on the button for something like this? I appreciate any help, thanks.&lt;/p&gt;&lt;p&gt;&amp;nbsp;--gsempcb&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>