<?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>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Line breaks when clipboarding a field through button form code</title><link>https://www.infopathdev.com:443/forums/thread/49893.aspx</link><pubDate>Sat, 12 Dec 2009 05:09:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49893</guid><dc:creator>Cjpbolton</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/49893.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=49893</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;You are an absolute genious, thank you SO much.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;For anyone who may hit this site in the future, this code worked for me.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim value As String = &amp;quot;/my:myFields/my:field10&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If value.Contains(&amp;quot;/characters/@crlf&amp;quot;) Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value.Replace(&amp;quot;/characters/@crlf&amp;quot;, &amp;quot;\n\r&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim nodeToCopy As XPathNavigator = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/my:myFields/my:field10&amp;quot;, NamespaceManager)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not String.IsNullOrEmpty(nodeToCopy.Value) Then&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Clipboard.SetText(nodeToCopy.Value, TextDataFormat.Text)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(&amp;quot;There is no text to copy&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt; &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Line breaks when clipboarding a field through button form code</title><link>https://www.infopathdev.com:443/forums/thread/49891.aspx</link><pubDate>Sat, 12 Dec 2009 02:47:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49891</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/49891.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=49891</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;It seems that even if you use that crlf trick, InfoPath changes the line breaks from CRLF to just LF at some point. Not sure why this is happening, but you can do the following to get around this.&amp;nbsp; This is C# but it sounds like you can figure out the VB equivalent:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;string value = nodeToCopy.Value;&lt;br /&gt;if(!value.Contains(&amp;quot;\r\n&amp;quot;))&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; value = value.Replace(&amp;quot;\n&amp;quot;, &amp;quot;\r\n&amp;quot;);&lt;br /&gt;}&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;Clipboard.SetText(value);&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;</description></item><item><title>Line breaks when clipboarding a field through button form code</title><link>https://www.infopathdev.com:443/forums/thread/49885.aspx</link><pubDate>Fri, 11 Dec 2009 17:44:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49885</guid><dc:creator>Cjpbolton</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/49885.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=49885</wfw:commentRss><description>&lt;p&gt;Hello Infopathdev! I have quite an interesting issue to share with you folks today. I&amp;#39;ll start off by stating VB is not my strongpoint.&amp;nbsp;But because&amp;nbsp;the builder in infopath can literally teach you how to write VB i&amp;#39;ve gotten a pretty good grasp of the syntaxs and what not.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll start off by explaining how I have my form laid out. I do not have this form set up for used to &amp;quot;submit&amp;quot; it in the traditional sense. Users fill out the fields in the form, once complete they press a button at the bottom of the form and it uses a formula to populate a text box with the information provided in the fields. That way they can just fill&amp;nbsp;out the fields, click the button, and copy/paste from the textbox&amp;nbsp;to notepad.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I ran into some troubles yesterday with the button. It would post all of the fields properly, but the text box would not do line breaks as the button at &amp;quot;set the fields value&amp;quot; was a function. To do this I had to create and XML file and add it as a secondary source so that I could use @crlf fields in my function to red-neck a line break in the text box, which mind you, outside of a little extra legwork on building the functions, works fine. The field would correctly populate like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Butter&lt;/p&gt;
&lt;p&gt;Eggs&lt;/p&gt;
&lt;p&gt;Milk&lt;/p&gt;
&lt;p&gt;Bread&lt;/p&gt;
&lt;p&gt;However, today I decided to create another button. This button, through some vb form coding, should allow me to copy the field to clipboard by simply clicking it. The code is as follows:&lt;/p&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; nodeToCopy &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; XPathNavigator = MainDataSource.CreateNavigator().SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:myFields/my:field10&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager)&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;If&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;Not&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;.IsNullOrEmpty(nodeToCopy.Value) &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Then&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;Clipboard.SetText(nodeToCopy.Value, TextDataFormat.CommaSeparatedValue)&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Else&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;MessageBox.Show(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;There is no text to copy&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;) &lt;/div&gt;&lt;/BLOCKQUOTE&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Now heres the issue, after building it and saving my form, it will correctly copy the field to clipboard almost like it should, heres my problem. When I go to paste this info, it loses its linebreaks like&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;ButterEggsMilkBread&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Iv&amp;#39;e tried many different text formats at &amp;quot;TextDataFormat.CommaSeparatedValue) and nothing seems to work.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;I&amp;#39;m open to any advice&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>