<?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: InfoPath Programming Tutorial(s)</title><link>https://www.infopathdev.com:443/forums/thread/89249.aspx</link><pubDate>Thu, 25 Apr 2013 18:57:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89249</guid><dc:creator>RobSil1976</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89249.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=89249</wfw:commentRss><description>&lt;p&gt;Ok here is one to get you started, bear in mind I use Infopath Filler 2007 so can&amp;#39;t guarantee what doesn&amp;#39;t work with web version... I&amp;#39;ve paraphrased my variable names a bit but should be fairly compilable :).&lt;/p&gt;

&lt;pre&gt;//To take value from dropdown list then query DB by it as a parameter...
  public void SomeButton_Clicked(object sender, ClickedEventArgs e)
        {
            XPathNavigator xpn = (XPathNavigator)e.Source;

            xpn.MoveToChild(&amp;quot;MyDropDownListElement&amp;quot;, xpn.NamespaceURI);
            
            string param = xpn.Value;
            if (string.IsNullOrEmpty(param)) {
                MessageBox.Show(&amp;quot;Please select a valid entry from the dropdown and try again.&amp;quot;, &amp;quot;Error&amp;quot;);
                return;
            }

            if (!IsFormEmpty) {
                if (MessageBox.Show(&amp;quot;You are about to load load data &amp;quot; + param+ &amp;quot;.  Any unsaved changes to the current data are about to be lost.  Do you wish to proceed?&amp;quot;,
                            &amp;quot;Confirm Load&amp;quot;, MessageBoxButtons.YesNo) == DialogResult.No)
                    return;

                
                LoadSomeTestData(param);
        
                IsFormEmpty = false;
                return;
            }            
        }

      private void LoadSomeTestData(string param)
        {

            string query = &amp;quot;SELECT [ColName1],[ColName2] FROM [DB_NAME].[dbo].[TableName] WHERE ColName1 = &amp;#39;&amp;quot; + param + &amp;quot;&amp;#39;&amp;quot;; ;

            AdoQueryConnection myAdoQueryConnection =
                   (AdoQueryConnection)(this.DataConnections[&amp;quot;MY_DB_CONNECTION&amp;quot;]);
            string oldCmd = myAdoQueryConnection.Command;
            myAdoQueryConnection.Command = query;
            myAdoQueryConnection.Execute();
            myAdoQueryConnection.Command = oldCmd;

            XPathNavigator queryNav = this.DataSources[&amp;quot;MY_DB_CONNECTION&amp;quot;].CreateNavigator();
            queryNav =  queryNav.SelectSingleNode(&amp;quot;//dfs:myFields/dfs:dataFields/d:TableName&amp;quot;, this.NamespaceManager);

   //And so on, now iterate the main fields and the data fields and swap out the data using XPath cmds.
        }

&lt;/pre&gt;</description></item><item><title>Re: InfoPath Programming Tutorial(s)</title><link>https://www.infopathdev.com:443/forums/thread/89246.aspx</link><pubDate>Thu, 25 Apr 2013 18:06:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89246</guid><dc:creator>mswilson4040</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89246.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=89246</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Yes, I will take C#. I would still like to hunt down some VB code though.&lt;/p&gt;</description></item><item><title>Re: InfoPath Programming Tutorial(s)</title><link>https://www.infopathdev.com:443/forums/thread/89243.aspx</link><pubDate>Thu, 25 Apr 2013 17:55:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89243</guid><dc:creator>RobSil1976</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89243.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=89243</wfw:commentRss><description>&lt;p&gt;Does it have to be Visual Basic?&amp;nbsp; I can share some code I wrote in C# if that helps.&lt;/p&gt;&lt;p&gt;R.&lt;/p&gt;</description></item><item><title>InfoPath Programming Tutorial(s)</title><link>https://www.infopathdev.com:443/forums/thread/89242.aspx</link><pubDate>Thu, 25 Apr 2013 16:56:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89242</guid><dc:creator>mswilson4040</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89242.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=89242</wfw:commentRss><description>&lt;p&gt;Is there anyone that can point me to some basic/beginner level videos so I can get the gist of programming in Visual Basic in InfoPath?&lt;/p&gt;&lt;p&gt;&amp;nbsp;Honestly, some sample code of pushing/pulling values from a single textbox would probably suffice. I can figure the rest out. I&amp;#39;m just looking how to get started...&lt;/p&gt;&lt;p&gt;Thank you in advance for any helpful input.&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>