Setting ComboBox SelectedItem from the LookUpID
<p>WinForms : I am loading my a combobox from my DB table letz say Titles (ID, Name).</p>

<pre><code>cbxTitle.DataSource = Se.Titles.ToList();
cbxTitle.ValueMember = "TitleID";
cbxTitle.DisplayMember = "TitleDesc";
</code></pre>

<p>&amp; I save the selected value with the Customer record,</p>

<pre><code>customer.TitleID = Convert.ToByte(cbxTitle.SelectedValue.ToString());
</code></pre>

<p>How do I display the saved title with the customer when I show back?? Please
note that I only get the TitleID with the Customer record and I do not have the
title.Name with me. Can I use the selected value for this?? please advise.</p>

<p>Regards,
Anil.</p>

<p>Hi, </p>

<p>this is what I am trying to do. I don't want to databind my controls, I can traverse through the ComBoBox.Items and I can see TitleDesc, TitleID values with ToString(). But I can't locate the item in the collection by the ValueMember. </p>

<pre><code>foreach (var item in cbxTitle.Items) 
{ 
if (item.ToString() == int(Customer.TitleID)) 
   { cbxTitle.SelectedItem = true; break; } 
}
</code></pre>

<p>something like this... Please help!</p>

<p>Regards,
Anil.</p>
