Click here to Skip to main content
15,881,898 members

Try this:
C#
string text1 = textBox1.Text;
boolean isFound = false;

foreach(object item in comboBox1.Items)
{
   DataRowView row = item as DataRowView;

   if(row != null && text1 == row["ColumnName"].ToString())
   {
        isFound = true;
        break;
   }
}

if (!isFound)
{
    MessageBox.Show("Text is not found in the combo box");
}
 
Share this answer
 
Comments
Parazival 13-Feb-15 2:26am    
thank you so much it's working
Peter Leow 13-Feb-15 2:38am    
You are welcome.
Parazival 16-Feb-15 0:47am    
hello i have an another question?
Form1 had one button if we click that button it wil show another form(Form2)
and my question is when ever we click on button previous form 2 be closed and new form2 should be open how to write code in windows forms
Peter Leow 16-Feb-15 1:46am    
Suggest post it as a new question.
thank you so much it's working
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900