Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a combo box for company on the form,when form gets load i fill combobox with company name as display member and company code as value member,Now What i want to do is when i m writting in the combobox i want to display names of company matching character i typed from the combo box like drop downlist. I have allready fill the combobox on page load and now want to display company names from member of combobox only
Posted
Updated 12-May-10 21:54pm
v2

The question needs to be clarified.

I understand English may not be your first language, and we generally try to help even when the question is ambiguous like this.

Could you supply more detail or rephrase the question to be more specific.
 
Share this answer
 
You need to use KeyPress event. After Key Press, compare records with combobox.Text and display only those which starts with the string present in comboBox.Text.
 
Share this answer
 
This answer comes from a totally brainless 'learning' program I wrote. But this method does exactly what you want (Just ignore the details of my data.)

<pre lang="cs">
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
int which = Convert.ToInt32(comboBox1.SelectedItem.ToString());
var tolearnrow = from q in Leitner.ToLearn
where q.Id == which
select q;

foreach (var onetolearn in tolearnrow)
{
string strTry = onetolearn[0].ToString();
label6.Text = onetolearn.Id.ToString();
label7.Text = onetolearn.Part_Id.ToString();
label12.Text = onetolearn.Side1;
label10.Text = onetolearn.Side2;
label9.Text = onetolearn.Side3;
label8.Text = onetolearn.A_B_TestDate;
label19.Text = onetolearn.A_C_TestDate;
label20.Text = onetolearn.B_A_TestDate;
label21.Text = onetolearn.B_C_TestDate;
label22.Text = onetolearn.C_A_TestDate;
label23.Text = onetolearn.C_B_TestDate;
label29.Text = onetolearn.A_B_GoodCount.ToString();
label28.Text = onetolearn.A_C_GoodCount.ToString();
label27.Text = onetolearn.B_A_GoodCount.ToString();
label26.Text = onetolearn.B_C_GoodCount.ToString();
label25.Text = onetolearn.C_A_GoodCount.ToString();
label24.Text = onetolearn.C_B_GoodCount.ToString();
label35.Text = onetolearn.A_B_BadCount.ToString();
label34.Text = onetolearn.A_C_BadCount.ToString();
label33.Text = onetolearn.B_A_BadCount.ToString();
label32.Text = onetolearn.B_C_BadCount.ToString();
label31.Text = onetolearn.C_A_BadCount.ToString();
label30.Text = onetolearn.C_B_BadCount.ToString();
}
}</pre>
 
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