<?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: Save and Close Button</title><link>https://www.infopathdev.com:443/forums/thread/93173.aspx</link><pubDate>Fri, 20 Sep 2013 06:24:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:93173</guid><dc:creator>larryking123</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/93173.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=93173</wfw:commentRss><description>&lt;p&gt;I looked high and low, trying to figure how to implement this. Dateime.now.tostring(&amp;quot;s&amp;quot;)&lt;/p&gt;&lt;p&gt;Took three days of searching and reading, since I am not a VB guru, most of the stuff was hard to understand and bieng on a deadline...&amp;nbsp; well&lt;/p&gt;&lt;p&gt;For those that need a nice random filename generator. I give you what it use, it isnot pretty. but if you want to save pdf without over writing previous and not asking use to put in a name&lt;/p&gt;&lt;p&gt;this will work everytime.&lt;/p&gt;&lt;p&gt;Here is the code. Hope it helps someone.&lt;/p&gt;&lt;p&gt;&amp;nbsp; button is pressed it will generate an filename without the :33 which the file systems hates. how to use the system clock to give me a number to append to the filename&lt;/p&gt;&lt;p&gt;two lines &lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;p&gt;Dim&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;font size="2"&gt; x &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; DateTime = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Date&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Now&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;p&gt;Dim&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;font size="2"&gt; x1 &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;String&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; = x.ToString(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;-mmss.fff&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;p&gt;So you filename will be&amp;nbsp; &lt;/p&gt;&lt;font size="2"&gt;&lt;p&gt;CurrentView.Export(&lt;/p&gt;&lt;/font&gt;&lt;p&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;c:\moc\&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp; WhoamI &amp;amp; &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;_&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp; Wrkflw_str &amp;amp; &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;_&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp; SCN_str &amp;amp; &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;_&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp; Role_str &amp;amp; &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;_&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp; Date_str &amp;amp; x1 &amp;amp; &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;.pdf&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, ExportFormat.Pdf)&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;p&gt;Notice where x1 is . The output will look like XXXX.2332.543&lt;/p&gt;&lt;p&gt;enjoy&lt;/p&gt;</description></item><item><title>Re: Save and Close Button</title><link>https://www.infopathdev.com:443/forums/thread/52778.aspx</link><pubDate>Tue, 16 Mar 2010 16:34:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52778</guid><dc:creator>Lawson</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52778.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52778</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Thanks, I&amp;#39;ll try this.&lt;/p&gt;
&lt;p&gt;How can I get the current name of the form and combine it with the DateTime.Now.ToString(&amp;quot;s&amp;quot;)?&lt;/p&gt;
&lt;p&gt;I think this will give&amp;nbsp;it&amp;nbsp;the best chance at being unique.&lt;/p&gt;
&lt;p&gt;-Lawson&lt;/p&gt;</description></item><item><title>Re: Save and Close Button</title><link>https://www.infopathdev.com:443/forums/thread/52771.aspx</link><pubDate>Tue, 16 Mar 2010 14:35:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52771</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52771.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52771</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;You can use &lt;b&gt;DateTime.Now.ToString(&amp;quot;s&amp;quot;)&lt;/b&gt; to get the current date and time in the format &lt;b&gt;2010-03-16T23:34:14&lt;/b&gt;, which has a pretty good chance of being unique.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Save and Close Button</title><link>https://www.infopathdev.com:443/forums/thread/52769.aspx</link><pubDate>Tue, 16 Mar 2010 14:21:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52769</guid><dc:creator>Lawson</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52769.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52769</wfw:commentRss><description>&lt;p&gt;Thanks Jimmy,&lt;/p&gt;
&lt;p&gt;Can I use the now() function for the formName to uniquely name the form?&lt;/p&gt;
&lt;p&gt;-Lawson&lt;/p&gt;</description></item><item><title>Re: Save and Close Button</title><link>https://www.infopathdev.com:443/forums/thread/52745.aspx</link><pubDate>Mon, 15 Mar 2010 23:39:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52745</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52745.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52745</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;In InfoPath 2003 code, it would be:&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;this.thisXDocument.SaveAs(&lt;span style="font-family:&amp;#39;Courier New&amp;#39;;font-size:10pt;"&gt;&lt;span style="color:maroon;"&gt;@&amp;quot;C:\Users\Lawson\Documents\Saved Forms\&amp;quot; + &lt;u&gt;formName&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;);&lt;br /&gt;this.thisApplication.Quit(true);&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Above, I&amp;#39;ve used &lt;u&gt;formName&lt;/u&gt; as a placeholder for the form name.&amp;nbsp; You&amp;#39;ll need to come up with a way of uniquely naming the forms.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Save and Close Button</title><link>https://www.infopathdev.com:443/forums/thread/52744.aspx</link><pubDate>Mon, 15 Mar 2010 22:43:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52744</guid><dc:creator>Lawson</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52744.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52744</wfw:commentRss><description>&lt;p style="MARGIN:0in 0in 10pt;" class="MsoNormal"&gt;&lt;font size="3" face="Calibri"&gt;I tried this with the following code:&lt;/font&gt;&lt;/p&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:10pt;mso-no-proof:yes;"&gt;this&lt;/span&gt;&lt;span style="FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:10pt;mso-no-proof:yes;"&gt;.Save_OnClick(&lt;span style="COLOR:maroon;"&gt;@&amp;quot;C:\Users\Lawson\Documents\Saved Forms&amp;quot;&lt;/span&gt;);&lt;/span&gt; 
&lt;p style="MARGIN:0in 0in 10pt;" class="MsoNormal"&gt;&lt;span style="LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;COLOR:blue;FONT-SIZE:10pt;mso-no-proof:yes;"&gt;this&lt;/span&gt;&lt;span style="LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;FONT-SIZE:10pt;mso-no-proof:yes;"&gt;.close();&lt;/span&gt;&lt;/p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="MARGIN:0in 0in 10pt;" class="MsoNormal"&gt;&lt;font size="3" face="Calibri"&gt;But I got the following errors.&lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN:0in 0in 10pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Error 1-- The best overloaded method match for &amp;#39;eFileroom_3_13_10.FormCode.Save_OnClick(Microsoft.Office.Interop.InfoPath.SemiTrust.DocActionEvent)&amp;#39; has some invalid arguments&lt;span style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN:0in 0in 10pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Error 2—Argument &amp;#39;1&amp;#39;: cannot convert from &amp;#39;string&amp;#39; to &amp;#39;Microsoft.Office.Interop.InfoPath.SemiTrust.DocActionEvent&amp;#39;&lt;span style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;FONT-SIZE:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt;Error 3—&amp;#39;eFileroom_3_13_10.FormCode&amp;#39; does not contain a definition for &amp;#39;close&amp;#39;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Re: Save and Close Button</title><link>https://www.infopathdev.com:443/forums/thread/52689.aspx</link><pubDate>Mon, 15 Mar 2010 05:15:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52689</guid><dc:creator>Qazi Anis</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52689.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52689</wfw:commentRss><description>&lt;p&gt;this.save(&amp;quot;path and location&amp;quot;);&lt;/p&gt;
&lt;p&gt;this.close();&lt;/p&gt;
&lt;p&gt;but this does not work for browser enabled forms.&lt;/p&gt;</description></item><item><title>Save and Close Button</title><link>https://www.infopathdev.com:443/forums/thread/52683.aspx</link><pubDate>Sun, 14 Mar 2010 16:37:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52683</guid><dc:creator>Lawson</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52683.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52683</wfw:commentRss><description>&lt;p&gt;I would like to create a button that saves the form to a specific path and then closes the form. &lt;/p&gt;
&lt;p&gt;Does anybody know how to do this in C#?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;-Lawson&lt;/p&gt;</description></item></channel></rss>