SIGN UP MEMBER LOGIN:    
ARTICLE

Autocomplete ComboBox (Windows Mobile)

Posted by Vimal Articles | ASP.NET Controls in C# July 21, 2010
Here is this article I will show functionality of auto complete combobox in normal combobox.
Reader Level:

Here is the code by which you can get functionality of Auto complete combobox in normal combobox.

Just set your combobox's DropDownStyle to System.Windows.Forms.ComboBoxStyle.DropDown and add the following code in KeyUp event of the same combobox.

private void cbo_KeyUp(object sender, KeyEventArgs e)
{
    string text = null;
    int num = -1;
    object item = null;
    string str3 = null;
    ComboBox box = (ComboBox)sender;
    switch (e.KeyCode)
    {
        case Keys.Left:
        case Keys.Up:
        case Keys.Right:
        case Keys.Down:
        case Keys.Delete:
        case Keys.Back:
        return;
        default:
            text = box.Text;
            for (int i = 0; i = 0)
            {
                item = box.Items[num];
                str3 = box.GetItemText(item).Substring(text.Length);
                box.Text = text + str3;
                box.SelectionStart = text.Length;
                box.SelectionLength = str3.Length;
                box.SelectedItem = item;
            }
    }
}

That's it!!!!!

Happy Windows Mobile Codding....

Login to add your contents and source code to this article
share this article :
post comment
 

for (int i = 0; i = 0; )
I am getting an error " cannot implicitly convert int to bool"  in for loop.
Can you tell me how to find the way.
Please.


Posted by rakesh baviskar Oct 19, 2010
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Team Foundation Server Hosting
Become a Sponsor