﻿<?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?)  » Getting the combo's display text from the corresponding edit value</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Mon, 08 Jun 2026 22:43:15 GMT</lastBuildDate><ttl>20</ttl><item><title>Getting the combo's display text from the corresponding edit value</title><link>http://forum.strataframe.net/FindPost16997.aspx</link><description>I have an inherited DevEx combo box, and I'm trying to do the following:&lt;/P&gt;&lt;P&gt;-If given a Value member (e.g. customer primary key) find the corresponding display text (e.g. customer name) as it shows in the combo box.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, say I have the following in a combo box where the first is the display text and second is the value member.&lt;/P&gt;&lt;P&gt;Andria Jensen - 5&lt;BR&gt;Trent Taylor - 10&lt;BR&gt;Ben Chase - 3&lt;/P&gt;&lt;P&gt;I should be able to find the text "Andria Jensen" from the combo box if I have the value 5.&amp;nbsp; I know you can do this with the Text property if you are trying to get the currently selected text.&amp;nbsp; However, what if I'm trying to get something that was previously selected?&amp;nbsp; Say comparing an original to a current value.&amp;nbsp; &lt;/P&gt;&lt;P&gt;I found this, but it doesn't seem to work correctly in all cases:&lt;BR&gt;ComboBoxCtl.Properties.GetDisplayText(EditValueToFind)&lt;/P&gt;&lt;P&gt;How would you guys go about accomplishing this?</description><pubDate>Thu, 12 Jun 2008 10:55:05 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Getting the combo's display text from the corresponding edit value</title><link>http://forum.strataframe.net/FindPost17022.aspx</link><description>LOL...&lt;/P&gt;&lt;P&gt;[quote]&lt;TABLE cellSpacing=0 cellPadding=0 width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class=smalltxt vAlign=top&gt;&lt;SPAN id=ctl02_ctlTopic_ctlPanelBar_ctlTopicsRepeater_ctl12_lblFullMessage&gt;I love cats . . . I just can't eat a whole one by myself.&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;[/quote]&lt;/P&gt;&lt;P&gt;Depends on the size of the cat :P</description><pubDate>Thu, 12 Jun 2008 10:55:05 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Getting the combo's display text from the corresponding edit value</title><link>http://forum.strataframe.net/FindPost17021.aspx</link><description>I think my dog could eat a whole one...</description><pubDate>Thu, 12 Jun 2008 10:30:23 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Getting the combo's display text from the corresponding edit value</title><link>http://forum.strataframe.net/FindPost17020.aspx</link><description>I love cats . . . I just can't eat a whole one by myself.&lt;/P&gt;&lt;P&gt;:smooooth:</description><pubDate>Thu, 12 Jun 2008 10:24:27 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Getting the combo's display text from the corresponding edit value</title><link>http://forum.strataframe.net/FindPost17017.aspx</link><description>Looks good :)&amp;nbsp; There is always more than one way to skin a cat...so to speak...I hope I didn't offend any cat lovers out there :D</description><pubDate>Thu, 12 Jun 2008 09:45:59 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Getting the combo's display text from the corresponding edit value</title><link>http://forum.strataframe.net/FindPost17016.aspx</link><description>Well, I think I&amp;nbsp;solved it with a function of my own.&amp;nbsp; How's this?&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;P&gt;Public&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Shared&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Function&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; GetDisplayText(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; combo &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; EditValue &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Object&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp; For&lt;/FONT&gt;&lt;FONT size=2&gt; i &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Integer&lt;/FONT&gt;&lt;FONT size=2&gt; = 0 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;To&lt;/FONT&gt;&lt;FONT size=2&gt; combo.Properties.Items.Count - 1&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; combo.Items(i).Value = EditValue &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Return&lt;/FONT&gt;&lt;FONT size=2&gt; combo.Items(i).Display&lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Next&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp; Return&lt;/FONT&gt;&lt;FONT size=2&gt; EditValue&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Function&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;And yes, Trent...On a scale of 1-10, 10 being the highest...you're right, you are 1.&amp;nbsp; :cool:&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Thu, 12 Jun 2008 09:39:53 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Getting the combo's display text from the corresponding edit value</title><link>http://forum.strataframe.net/FindPost17004.aspx</link><description>Oh...by the way, I noticed that you had something wrong in your sample above, it should have been like this:&lt;/P&gt;&lt;P&gt;[codesnippet]Trent Taylor = 1[/codesnippet]&lt;/P&gt;&lt;P&gt;:D</description><pubDate>Wed, 11 Jun 2008 22:15:44 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Getting the combo's display text from the corresponding edit value</title><link>http://forum.strataframe.net/FindPost17003.aspx</link><description>If you don't want to change your combo over to a LookupEdit control, the I would recommend looking at the DataSource of the combo instead of trying to look at the text property.&amp;nbsp; When you populate the combo via a PopulationDataSource mechanism, we will create a data table that gets attached to the DataSource of the combo.&amp;nbsp; There will be two&amp;nbsp;columns within the data table (I am not positive, but it will be something like Display and Value for the names, but you can test this on a debug or something).&amp;nbsp; At any rate, I would use the ADO.NET route as it will always be faster in this case.&amp;nbsp; For example:&lt;/P&gt;&lt;P&gt;[codesnippet]If DirectCast(MyCombo.DataSource, DataTable).Select("Display = '" &amp;amp; MySearchValue &amp;amp; "'").Length &amp;gt; 0 Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- You have a hit, you can get the value from the results in the above query, etc.&lt;BR&gt;End If[/codesnippet]</description><pubDate>Wed, 11 Jun 2008 22:14:34 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Getting the combo's display text from the corresponding edit value</title><link>http://forum.strataframe.net/FindPost17000.aspx</link><description>G'day&lt;/P&gt;&lt;P&gt;I'd recommend that instead of using the devexpress ComboBoxEdit, you should use the devexpress LookupEdit. The LookupEdit can be populated from a BO via a BBS and so you would be doing all your searching in a familiar strataframe BO.&lt;/P&gt;&lt;P&gt;We don't use the ComboBoxEdit at all, we've found the LookupEdit&amp;nbsp;far more flexible.&lt;/P&gt;&lt;P&gt;Peter&amp;nbsp;</description><pubDate>Wed, 11 Jun 2008 18:58:22 GMT</pubDate><dc:creator>Peter Denton</dc:creator></item></channel></rss>