ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Microsoft Related  >>  Dot Net  >>  Dot Net WindowsForms
 
 


 

 
 Dot Net Framework interview questions  Dot Net Framework Interview Questions
 Dot Net Remoting interview questions  Dot Net Remoting Interview Questions
 Dot Net WindowsForms interview questions  Dot Net WindowsForms Interview Questions
 Dot Net General interview questions  Dot Net General Interview Questions
 Dot Net AllOther interview questions  Dot Net AllOther Interview Questions
Question
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
 Question Submitted By :: Baskar
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
# 1
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 ?    16 Yes 4 No
Usha
 
  Re: 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
# 2
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 4 No
Mona
 
 
 
  Re: 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
# 3
/* 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 ?    1 Yes 3 No
Cutee
 
  Re: 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
# 4
Compare the values in both the comboboxes :


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

}
 
Is This Answer Correct ?    5 Yes 1 No
Guest
 
  Re: 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
# 5
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 ?    0 Yes 0 No
Pavel
 

 
 
 
Other Dot Net WindowsForms Interview Questions
 
  Question Asked @ Answers
 
what is acomponent in windows applications?  1
How to find the current record position in data control? TechSolution1
How do you check whether the row data has been changed?  1
How do you hide the columns in datagrid?  2
which property of menu cannot be set at run time?  1
What is the use of stretch property in Image control?  1
what are events?  3
What is the default property of data control? Wipro1
How many number of events does the Timer controls ?  5
which Property is used to count no. of items in a combobox?  3
how to create a set up in vb.net for desktop application please say me steps with examples  1
For a server control, you need to have same properties like color maxlength, size, and allowed character throughout the application. How do you handle this? Microsoft1
What is datagrid? ABC5
If you are calling three SPs from a window application how do u check for the performance of the SPS ? Accenture1
how barcode create in the report Wipro2
What is the max size of textbox?  1
what are the differences between image and picture controls?  1
what is the difference between checkbox and radiobutton? TCS12
What is the need of z-order method? Accel3
How do you display an editable drop-down list?  1
 
For more Dot Net WindowsForms Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com