<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Populate Drop Down Box</title><link>https://www.infopathdev.com:443/forums/thread/52765.aspx</link><pubDate>Tue, 16 Mar 2010 13:52:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52765</guid><dc:creator>newbie999</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52765.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=52765</wfw:commentRss><description>&lt;p&gt;I did find this link, that refreshes data from secondary source:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://office.microsoft.com/en-us/infopath/HP011095581033.aspx"&gt;&lt;font color="#0066dd"&gt;http://office.microsoft.com/en-us/infopath/HP011095581033.aspx&lt;/font&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This has brought me closer to my goal, but there is still a problem (outside the fact that the user has to hit Refresh).&amp;nbsp; I changed the XML file and hit refresh, but the drop down did not change.&amp;nbsp; I closed out of the debugger and fired it up again and *that* is when I saw the changes to the drop down list.&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Populate Drop Down Box</title><link>https://www.infopathdev.com:443/forums/thread/52648.aspx</link><pubDate>Thu, 11 Mar 2010 19:11:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52648</guid><dc:creator>newbie999</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52648.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=52648</wfw:commentRss><description>&lt;p&gt;Thanks for the quick reply.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I found this page, which seems to suggest the same solution that you have outlined:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.bizsupportonline.net/infopath2007/programmatically-fill-populate-drop-down-list-box-infopath-2007.htm"&gt;http://www.bizsupportonline.net/infopath2007/programmatically-fill-populate-drop-down-list-box-infopath-2007.htm&lt;/a&gt;&amp;nbsp; Link #1&lt;/p&gt;
&lt;p&gt;I got this to work, but if players.xml was changed, the drop down list&amp;nbsp;didn&amp;#39;t reflect it.&amp;nbsp; I had to save the file as players2.xml and then&amp;nbsp;set player2.xml as my secondary data source.&amp;nbsp; Also, I don&amp;#39;t understand why he has 2 xml files.&amp;nbsp; That is, assuming that is was &amp;quot;players&amp;quot; is, and I&amp;#39;m not completely off base.&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;font face="Arial"&gt;Also, you&amp;nbsp;mention XmlWriter.WriteElementString(string, string,&amp;nbsp;string).&amp;nbsp;&amp;nbsp;Are you saying&amp;nbsp;to&amp;nbsp;programatically create&amp;nbsp;&amp;nbsp;the&amp;nbsp;XML file to be used as my secondary data source?&amp;nbsp; That is, loop through my collection and write&amp;nbsp;values to an XML file (using&amp;nbsp; XmlWriter.WriteElementString(string, string,&amp;nbsp;string)) and save it to a file called&amp;nbsp;(for example) C:\List.xml.&amp;nbsp;&amp;nbsp;I may have oversimplified things, but I did it a little differently&amp;nbsp;as described here:&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aex0e7zs.aspx"&gt;http://msdn.microsoft.com/en-us/library/aex0e7zs.aspx&lt;/a&gt;&amp;nbsp;&amp;nbsp; Link #2&lt;/p&gt;
&lt;p&gt;This seemed to work.&amp;nbsp; I created an xml file with a list from my TFS lookup, as mentioned in Link #2&amp;nbsp;and set that as my secondary data source.&amp;nbsp; When I ran the form, the drop down was populated with the list that was returned from the TFS lookup.&amp;nbsp;&amp;nbsp; However, if I change the script wherein I change the data in the xml file, the drop down does not reflect that.&amp;nbsp; That is, even though the&amp;nbsp;xml&amp;nbsp;file generated had indeed changed, (I verified that it indeed had), the drop down contained the data from the old xml file.&amp;nbsp; I had to rename the file and add the new file as my&amp;nbsp;secondary data source.&amp;nbsp; This&amp;nbsp;was my experience with the example in Link #1.&amp;nbsp;&amp;nbsp;&lt;font face="Courier New"&gt;&lt;font face="Arial"&gt;For my purposes, the&amp;nbsp;xml file that is used to populate the drop down box would need to be created anew.&amp;nbsp; Each time the form was loaded, I am creating a new xml file but the drop down doesn&amp;#39;t pick up the new file, even though&amp;nbsp;it is the secondary data source.&amp;nbsp; It seems that once you set a file&amp;nbsp;to be your secondary data source, it takes a snapshot of that file at the time the source was added as a secondary data source and if you change the file, you must rename and add it as your secondary source. &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Also, I&amp;nbsp;am not sure how to use the XPathNavigator.AppendChild() (no arguments) and XPathNavidator.DeleteSelf() methods figure into this.&amp;nbsp; Would they alleviate the problem I am having with the drop down not reflecting the xml file.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;span class="tab"&gt;&lt;/span&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;span class="tab"&gt;&lt;/span&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;span class="tab"&gt;&lt;/span&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Populate Drop Down Box</title><link>https://www.infopathdev.com:443/forums/thread/52612.aspx</link><pubDate>Wed, 10 Mar 2010 18:57:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52612</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52612.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=52612</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;You will need to have the dropdown populated from a repeating field somewhere (most likely a secondary data source), and you will need to add and remove nodes to that location, not the location where the control is bound.&amp;nbsp; Aside from the obvious ones (like SelectSingleNode()), these methods should be enough to accomplish what you need:&lt;/p&gt;&lt;p&gt;XPathNavigator.AppendChild() (no arguments)&lt;/p&gt;&lt;p&gt;XPathNavidator.DeleteSelf()&lt;/p&gt;&lt;p&gt;XmlWriter.WriteElementString(string, string, string) &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Populate Drop Down Box</title><link>https://www.infopathdev.com:443/forums/thread/52610.aspx</link><pubDate>Wed, 10 Mar 2010 18:22:07 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52610</guid><dc:creator>newbie999</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52610.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=52610</wfw:commentRss><description>&lt;p&gt;I&amp;nbsp;would like to populate a drop down&amp;nbsp;box with employee names. I have&amp;nbsp;written&amp;nbsp;C# code to get the list of names&amp;nbsp;(a ReadOnlyCollection) but I don&amp;#39;t know how to add the names to the drop down box. I have tried XPathNavigator and XPathIterator, but the XML shows only the item that the user selected.&amp;nbsp; I manually added a bunch of items but the items are not seen in the&amp;nbsp;XML.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have read up on this at some length and everything points to creating xml files, which would be difficult with such a large number of items.&amp;nbsp; I have the information I need in a ReadOnlyCollection and I just want to get it into the drop down box.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thanks.&lt;/p&gt;</description></item></channel></rss>