I have a comboBox with items populating from a database(sql express). I want to prevent the users from saving the file with their own custom input. What I want is when saved is clicked then there is some prompt of some kind that says something like: "no valid item from the list was entered." Currently am using the leave event. This is the code:
private void comboBox3_Leave(object sender, EventArgs e)
{
ComboBox cb = (ComboBox)sender;
if (!comboBox3.Items.Contains(cb.Text))
{
MessageBox.Show("Not a valid Cari-med Item!");
}
It works but am just asking to see if there are other ways to accomplish what am asking. I already tried changing the style to dropDownList upon my research. That method will not work for me because the user must be able to type and see the suggestions based on each character typed. Cannot have the user scrolling thru so much records. Is there any other way to accomplish this?