I have a combobox and the items of the group membership look like
- 200;Heater
- 300;Cooler
- 400;Fan
If I select a part, only the number of the membership e.g. 200 is stored in the database.
Now I want to do a pre selection of the combobox. To check if the combobox contains a membership number is working.
void MembershipPreSelection(ComboBox cb, string text)
{
if (cb.Items.Cast<Part>().Any(c => c.Membership.Contains(text)))
{
// now I want the string for the item that contains the text.
}
}
But to get the text of the combobox item (e.g. 200;Heater)?? This is what I tried, but I do not get the item text.
string m = cb.Items.Cast<Part>().Where(c => c.Hauptbaugruppe.Contains(text)).ToString();