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 is dynamic linking?

658


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

568


Is form action required?

522


What are controls in windows forms?

538


Name the event that enables the user to prevent shifting of focus from control until all the validation rules have been met.

529






Suppose I am implementing one windows form. I am inserting some values into ms access. In that table 5 columns there. But I want to insert three columns only. When I am clicking another button then other two values also insert into that table?

549


Name the property which is used to specify the source from where the crystal reports would be accessed.

559


How to use the FindControl() function to preselect an item in my dropdownlist?

1709


What is the full form of gac?

652


Explain how barcode create in the report?

579


What is the extension of a compiled help project file?

582


What is the use of form?

537


What is the extension of the windows installer file?

585


how print PGL by XML

2625


Which template creates a .net compact framework 2.0 forms application for pocket pc 2003 and later?

569