The question is not clear; and it is not clear why do you use
Contains
. It looks like you just need a text of a selected item:
object selectedItem = Form1.Combobox1.SelectedItem;
if (selectedItem != null) {
string selectedText = selectedItem.ToString();
}
Please do yourself a favor: never leave ugly auto-generated names like
Form1
,
Combobox1
, renamed all of them to give them some semantic names. Those auto-generated names even violate Microsoft naming conventions — test your assembly by FxCop to see. Why do you thing you have a refactoring engine?
—SA