Click here to Skip to main content
12,950,099 members (41,188 online)
Rate this:
Please Sign up or sign in to vote.
See more:
C# combobox (search anywhere within list, not just first letter autocomplete) using with windiows form applicaiton
Posted 14-Jan-13 17:18pm
David_Wimbley 14-Jan-13 23:19pm
What list are you talking about? A list box control list? The list of items that pops open when you type in a combo box?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


In WPF[^]
In Windows[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

private void comboBox1_KeyUp(object sender, KeyEventArgs e)
            //index of taped text
            int index;
            //text found
            string found;
            //text written
            string actual;
            //to avoid these keys
            bool bo = e.KeyCode == Keys.Back || e.KeyCode == Keys.Left
            || e.KeyCode == Keys.Right || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down
            || e.KeyCode == Keys.Delete || e.KeyCode == Keys.PageDown
            || e.KeyCode == Keys.PageUp || e.KeyCode == Keys.End
            || e.KeyCode == Keys.Home;
            if (bo == true)
            actual = this.comboBox1.Text;
            index = this.comboBox1.FindString(actual);
            //this condition means that there is a result
            if (index > -1)
                found = this.comboBox1.Items[index].ToString();
                this.comboBox1.SelectedIndex = index;
                this.comboBox1.SelectionStart = actual.Length;
                this.comboBox1.SelectionLength = found.Length;
                this.comboBox1.DroppedDown = true;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,749
CHill60 3,380
Maciej Los 2,953
Jochen Arndt 1,935
ppolymorphe 1,820

Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 28 Jun 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100