I have two combobox .. and i have some items in both combobox
now i need to check the item in both combobox if same item
is Present in both combobox i need to display that item in
message box

Answer Posted / pavel

bool found = false;
string item = string.Empty;
foreach (string item1 in comboBox1.Items)
{
foreach (string item2 in comboBox2.Items)
if (item1 == item2)
{
item = item1;
found = true;
break;
}
if (found) break;
}
MessageBox.Show(found ? item : "Not found");

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the three states set in a checkstate property?

755


Explain how many number of events does the timer controls?

728


How many navigational features are provided by visual studio.net ide?

824


Explain the need of z-order method?

748


How many types of dialog boxes windows provides?

796


how print PGL by XML

2792


What is form and meaning?

678


Which property value of the helpnavigator property will display the index for a specified topic?

795


What is the difference between a document and a form?

775


Name the class to be inherited for creating a custom control.

765


What is form application?

742


Is typeform free?

733


Which dialog box allows users to switch to another area of the application?

812


Which method of the messagebox class is used to display a message in the message box?

763


What is the use of runworkasync() methods?

795