﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » Problem with Combobox</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Thu, 24 Sep 2026 10:48:30 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Problem with Combobox</title><link>http://forum.strataframe.net/FindPost11207.aspx</link><description>The problem is most likely that your combo box is not setting the SelectedValue properly.&amp;nbsp; Check the SelectedValue property of the ComboBox and see what the value is.&amp;nbsp; Also, you might post the stack trace from that exception dialog that pops up, it might help.&lt;/P&gt;&lt;P&gt;Also, if the SelectedValue is wrong, then you might need to use the DataSource property of the ComboBox.&amp;nbsp; Instead of adding the items directly, create a DictionaryEntry[] and set it as the data source:&lt;/P&gt;&lt;P&gt;DictionaryEntry[] dataSource = new DictionaryEntry[] {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new DictionaryEntry("Pessoa F¡sica", "F"),&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;new DictionaryEntry("Pessoa Jur¡dica", "J"),&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new DictionaryEntry("Prospect", "P"),&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new DictionaryEntry("Internacional", "I") };&lt;BR&gt;cbTipo.DataSource = dataSource;&lt;BR&gt;cbTipo.DisplayMember = "Key";&lt;BR&gt;cbTipo.ValueMember = "Value";&lt;/P&gt;&lt;P&gt;That should get you fixed.&lt;BR&gt;</description><pubDate>Wed, 29 Aug 2007 10:20:31 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>Problem with Combobox</title><link>http://forum.strataframe.net/FindPost11181.aspx</link><description>Hi,&lt;/P&gt;&lt;P&gt;I have a combobox that it is populado thus:&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;---------&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;cbTipo.Items.Add(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DictionaryEntry&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Pessoa F¡sica"&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"F"&lt;/FONT&gt;&lt;FONT size=2&gt;));&lt;/P&gt;&lt;P&gt;cbTipo.Items.Add(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DictionaryEntry&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Pessoa Jur¡dica"&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"J"&lt;/FONT&gt;&lt;FONT size=2&gt;));&lt;/P&gt;&lt;P&gt;cbTipo.Items.Add(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DictionaryEntry&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Prospect"&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"P"&lt;/FONT&gt;&lt;FONT size=2&gt;));&lt;/P&gt;&lt;P&gt;cbTipo.Items.Add(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DictionaryEntry&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Internacional"&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"I"&lt;/FONT&gt;&lt;FONT size=2&gt;));&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;---------&lt;BR&gt;&lt;BR&gt;This textbox is&amp;nbsp;bind with a field string of the Business Object that in the data base keeps value&amp;nbsp;“F”, “J”, “P”, “I”.&lt;BR&gt;&lt;BR&gt;When I select an option of the Combobox gives an error of cast (Unable you cast object of type “System.DBNull” to type “System.String”.)&lt;/P&gt;&lt;DIV id=result_box dir=ltr&gt;I already configured in the Customize wizard:&lt;BR&gt;&lt;BR&gt;Return Alternate on Null/Set Null on Alternate (value type) = string. Empty&lt;/DIV&gt;&lt;P&gt;You can help me?</description><pubDate>Wed, 29 Aug 2007 10:20:31 GMT</pubDate><dc:creator>Luiz Carneiro Lima</dc:creator></item></channel></rss>