Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

I need to select names in drop down list and using a text box and search button.

Can some one help me in c# coding for this case?
Posted
Comments
Reshma Babu 8-Jan-14 0:29am    
Please do elaborate the scenario
BillWoodruff 8-Jan-14 1:05am    
Windows Forms ? ... or ... ?
Asa code 8-Jan-14 1:26am    
yes windows form
Member 10495699 8-Jan-14 1:12am    
plz give actual details what you want
Alexander Dymshyts 8-Jan-14 5:49am    
Can you provide your code?

Assume your ComboBox in DropDownList mode is 'comboBox1; your TextBox for trying to match an Item in the ComboBox is 'textBox1; your button for triggering the attempt to match and select is 'button1:

Define a Click EventHandler for 'button1:
C#
private void button1_Click(object sender, EventArgs e)
{
    string theString = textBox1.Text;

    if (theString == string.Empty) return;

    object strAsObject = theString as object;

    if (comboBox1.Items.Contains(strAsObject))
    {
        comboBox1.SelectedItem = strAsObject;
    }
}
I am curious why you wish to provide a second means of selecting Items in the ComboBox.
 
Share this answer
 
Does ComboBox.AutoCompleteMode Property[^] isn't enough with AutoCompleteMode Enumeration[^] set to SuggestAppend?
 
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