Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



I have two combobox .. and i have some items in both combobox now i need to check the item in both ..

Answer / usha

For inti As Integer = 0 To ComboBox1.Items.Count - 1
For intj As Integer = 0 To ComboBox2.Items.Count - 1
If ComboBox1.Items(inti).ToString =
ComboBox2.Items(intj).ToString Then
MessageBox.Show(ComboBox1.Items(inti))
End If
Next
Next

Is This Answer Correct ?    22 Yes 7 No

I have two combobox .. and i have some items in both combobox now i need to check the item in both ..

Answer / 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

I have two combobox .. and i have some items in both combobox now i need to check the item in both ..

Answer / kirupa

for (int i = 0; i <= comboBox1.Items.Count-1; i++)
{
for (int j = 0; j <= comboBox2.Items.Count-1; j++)
{
if (comboBox1.Items[i].ToString() == comboBox2.Items
[j].ToString())
MessageBox.Show(comboBox1.Items[i].ToString());
}
}

Is This Answer Correct ?    3 Yes 2 No

I have two combobox .. and i have some items in both combobox now i need to check the item in both ..

Answer / rejeesh

foreach (string item1 in comboBox1.Items)
{
foreach (string item2 in comboBox2.Items)
if (item1 == item2)
{
MessageBox.Show(item1);
}
}

Is This Answer Correct ?    1 Yes 1 No

I have two combobox .. and i have some items in both combobox now i need to check the item in both ..

Answer / somnath

int countFirstBox=comboBox1.Items.Count;
int countSecondBox=comboBox2.Items.Count;
if(countFirstBox==countSecondBox)
{
MessageBox.Show(comboBox1.Items);

}

Is This Answer Correct ?    0 Yes 0 No

I have two combobox .. and i have some items in both combobox now i need to check the item in both ..

Answer / atiullah siddique

for (int i = 0; i <= comboBox1.Items.Count-1; i++)
{
for (int j = 0; j <= comboBox2.Items.Count-1; j++)
{
if (comboBox1.Items[i].ToString() == comboBox2.Items
[j].ToString())
MessageBox.Show(comboBox1.Items[i].ToString());
}
}

Is This Answer Correct ?    0 Yes 0 No

I have two combobox .. and i have some items in both combobox now i need to check the item in both ..

Answer / guest

Compare the values in both the comboboxes :


if(comboBox1.Text == comboBox2.Text)
{
MessageBox.Show(comboBox1.Text);

}

Is This Answer Correct ?    7 Yes 8 No

I have two combobox .. and i have some items in both combobox now i need to check the item in both ..

Answer / cutee

/* C# Version */

for (int i=0; i<= ComboBox1.Items.Count)
{
for(int j=0 ; j<= ComboBox2.Items.count)
{
if (ComboBox1.Items[i].Text == ComboBox2.Items
[j].Text)
MessageBox.Show(Items[i].Text);
}
}

Is This Answer Correct ?    3 Yes 6 No

I have two combobox .. and i have some items in both combobox now i need to check the item in both ..

Answer / mona

For inti As Integer = 0 To ComboBox1.Items.Count
For intj As Integer = 0 To ComboBox2.Items.Count
If ComboBox1.Items(inti).ToString =
ComboBox2.Items(intj).ToString Then
MessageBox.Show(ComboBox1.Items(inti))
End If
Next
Next


The answer should be modified. The loop should not go upto
the count-1 but should go upto count. Rest all is OK.

Is This Answer Correct ?    1 Yes 8 No

Post New Answer

More Dot Net WindowsForms Interview Questions

What are the different types of indexes in SQL Server?

3 Answers   Arctern,


To which namespace does the control class belong?

0 Answers  


How save rerecord in the database?

0 Answers  


What is form and meaning?

0 Answers  


What are the components of gui for windows?

0 Answers  


Explain about crystal report in brief?

0 Answers  


How many number of events does the Timer controls ?

5 Answers  


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

0 Answers  


What is the full form of gac?

0 Answers  


Explain how insert record in the database?

0 Answers  


Which is the global event handler for unhandled exceptions in an ASP.NET applications?

2 Answers   Arctern,


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

0 Answers  


Categories