ComboBox Should Allow Only ComboBox Listed Items While Typing In C#
In Winforms..In My ComboBox I have 100 Items. While I Am Typing In The ComboBox It Should Accept.But When I Typed A Text That Is Not In the ComboBox Items, Then It Should Show A MessageBox That Is "The Item Is Not In The List"...Please Help Me.....

Rakesh KaushikPosted Feb 28, 2013, 2:15 AM
at last found one.
Very simple dear, just use findstring method in leave event.
int index = combobox1.FindString(combobox1.Text);
if (index < 0)
{
MessageBox.Show("Invalid Record");
combobox1.Focus();
return;
}
Cheers
CHAITANYA KIRAN KASANIPosted Sep 22, 2012, 2:33 AM
VulpesPosted Sep 21, 2012, 6:45 PM
FWIW, you'd need to handle the TextChanged event and the code would be something like this: