Solved

Combobox Match Behaviour when DropDownStyle = DropDownList

Posted on 2016-08-23
6
35 Views
Last Modified: 2016-09-03
I have an Combobox with DropDownStyle = DropDownList. This DropDownStyle should not be changed!
When the user types a Letter, the DropDownList moves to the first entry starting with this letter. Is it possible to overwrite this behaviour? For example the DropDownList should move to the first entry containing the letter, typed by the user?
0
Comment
Question by:jdkern
  • 3
  • 3
6 Comments
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 41766499
You can not achieve this without customization. You need to write custom code and extend the behaviour of the Combobox.
Please refer the following article:
http://www.codeproject.com/Tips/755707/ComboBox-with-Suggestions-Based-on-Loose-Character
0
 

Author Comment

by:jdkern
ID: 41766554
Sorry, the proposed example from codeproject does not work with DropDownStyle = DropDownList!
Clearly, I have to write custom code to change the behaviour. But which method should I best overwrite? KeyPress? Or is there a better way?
0
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 41766591
You can use the onSelectionChanged event
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Accepted Solution

by:
jdkern earned 0 total points
ID: 41775849
Thank you, Ramkisan Jagtap!

I solved my Problem.

Roughly speaking I catch the pressed Letters in KeyPress and store them in a string "userInput".
In OnSelectedIndexChanged I search the best match for "userInput" with the help of the FindString method and set SelectedIndex to the corresponding value.
0
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 41775892
Good to know that you found the solution.

 Cheers
0
 

Author Closing Comment

by:jdkern
ID: 41782781
?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question