﻿<?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?)  » Setting the combobox selection based on value instead of index</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 12:21:16 GMT</lastBuildDate><ttl>20</ttl><item><title>Setting the combobox selection based on value instead of index</title><link>http://forum.strataframe.net/FindPost3329.aspx</link><description>I'm using the Inherited UI ComboBoxEdit&amp;nbsp;and&amp;nbsp;I&amp;nbsp;want to save the selection of this and a bunch of other combos on a form and then be able to restore them when I come back to that same form.&amp;nbsp; The ValueMember and DisplayValue properties may not be the same and for other reasons I need to save out the SelectedValue instead of the SelectedIndex.&amp;nbsp; I can save it out just fine using the SelectedValue property.&amp;nbsp; Is there a way to just set a property on the combo box and have it select the corresponding item in the list when I go to restore my selections?&amp;nbsp; I tried setting&amp;nbsp;SelectedValue to the value which was saved out, but this does not work.&amp;nbsp; I was going to just right a little method to search through the Items collection and set SelectedIndex based on which item matches the saved SelectedValue.&amp;nbsp; I just wanted to make sure there wasn't an easier way before I implement unnecessary code.&amp;nbsp; Thanks :)</description><pubDate>Thu, 05 Oct 2006 14:51:01 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Setting the combobox selection based on value instead of index</title><link>http://forum.strataframe.net/FindPost3334.aspx</link><description>Awesome, thanks!&amp;nbsp; Yes, the one I was having problems with specifically was using an&amp;nbsp; integer value as the ValueMember.&amp;nbsp; That's probably where my problem is coming from.&amp;nbsp; Let me know when I can download the update.&amp;nbsp; Thanks again.</description><pubDate>Thu, 05 Oct 2006 14:51:01 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Setting the combobox selection based on value instead of index</title><link>http://forum.strataframe.net/FindPost3330.aspx</link><description>You should be able to set the SelectedValue property directly, however, there was a logic error in the way that the indexor for the items collection was being called... if the type of the selected value was an integer, then the wrong overload was being called and it would not have given you the correct functionality.&amp;nbsp; I fixed it and we're going to post an update later today, probably within the next couple of hours.&amp;nbsp; I'll let you know.</description><pubDate>Thu, 05 Oct 2006 13:43:07 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item></channel></rss>