<?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: Drop-Down List Box : option/value pair</title><link>https://www.infopathdev.com:443/forums/thread/13169.aspx</link><pubDate>Fri, 11 Mar 2005 17:11:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13169</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13169.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13169</wfw:commentRss><description>Getting the Option data if you give values directly to the dropdown is not possible as far as i know. But here is one workaround for your &lt;br /&gt;&lt;br /&gt;problem. Create an xml file in the following manner &lt;br /&gt;&lt;br /&gt;&amp;lt;SelectOptions&amp;gt;&lt;br /&gt;	&amp;lt;Select option = "Option1" value = "value1"&amp;gt;&amp;lt;/Select&amp;gt;&lt;br /&gt;	&amp;lt;Select option = "Option2" value = "value2"&amp;gt;&amp;lt;/Select&amp;gt;&lt;br /&gt;&amp;lt;/SelectOptions&amp;gt;&lt;br /&gt;&lt;br /&gt;1. Add this file as a resource file via Tools -&amp;gt; resource files. &lt;br /&gt;2. Then create a data connection to this resource file via Tools -&amp;gt; Data connections. &lt;br /&gt;3. Double click on the dropdown in the view and choose the third option for the listbox entries, choose the data connection that &lt;br /&gt;&lt;br /&gt;you just created and set the value and display names correctly. Now the following code should work to get the display name.&lt;br /&gt;&lt;br /&gt;//First read the value into a string&lt;br /&gt;IXMLDOMNode nodePropertyName = thisXDocument.DOM.selectSingleNode("/my:myFields/my:grpPropertyName/my:ddlPropertyName")&lt;br /&gt;&lt;br /&gt;string value = null;&lt;br /&gt;&lt;br /&gt;If (null != nodePropertyName)&lt;br /&gt;value = thisXDocument.DOM.selectSingleNode ("/my:myFields/my:txtPropertyNumber").text = nodePropertyName.text&lt;br /&gt;&lt;br /&gt;else &lt;br /&gt;return;&lt;br /&gt;&lt;br /&gt;//Now to get the "Option" first get the newXmlFile. ConnectionName is the name that you give while creating the data connection.&lt;br /&gt;IXMLDOMDocument2 xmlDoc= (IXMLDOMDocument2)thisXDocument.GetDOM("ConnectionName");&lt;br /&gt;&lt;br /&gt;//Xpath of option in the XML file&lt;br /&gt;string optionXPath = string.format("/SelectOptions/Select[@value = '{0}']/@option", value);&lt;br /&gt;&lt;br /&gt;//read the option from xmlfile&lt;br /&gt;string Option = xmlDoc.selectSingleNode(optionXPath).text;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Agni</description></item><item><title>Drop-Down List Box : option/value pair</title><link>https://www.infopathdev.com:443/forums/thread/12433.aspx</link><pubDate>Thu, 10 Mar 2005 23:10:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12433</guid><dc:creator>asmithDeveloper</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12433.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12433</wfw:commentRss><description>Hi All,&lt;br /&gt;&lt;br /&gt;I'm stumbling over something quite simple in other programming environments. My question is this: How can I obtain the 'option' in an option/value pair in an InfoPath Drop-Down List Box I call ddlPropertyName?&lt;br /&gt;&lt;br /&gt;I know how to get the 'value' for my PropertyNumber text box like so:&lt;br /&gt;&lt;br /&gt;Dim nodePropertyName As IXMLDOMNode&lt;br /&gt;nodePropertyName = thisXDocument.DOM.selectSingleNode("/my:myFields/my:grpPropertyName/my:ddlPropertyName")&lt;br /&gt;&lt;br /&gt;If Not nodePropertyName Is Nothing Then&lt;br /&gt;   thisXDocument.DOM.selectSingleNode ("/my:myFields/my:txtPropertyNumber").text = &lt;b&gt;nodePropertyName.text&lt;/b&gt;&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, how do I get the displayed 'option'?&lt;br /&gt;&lt;br /&gt;   thisXDocument.DOM.selectSingleNode("/my:myFields/my:txtProperty").text = &lt;b&gt;nodePropertyName.????&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Thanks in advance,&lt;br /&gt;&lt;br /&gt;Arnold&lt;br /&gt;</description></item></channel></rss>