Populating Combo Box on Key Press Event
-
i am populating combobox on keypress event of the combobox. when three character are pressed, i get for the text so for written in the combobox and search the text in the database, after searching if results are found, combo-box is clear & populated again using a for loop ( since the result after the database query is an ArrayList). Next i do this combox.DroppedDown=true, Now here comes the problem, the selected text (i.e the characters that are written in the combox box are cleared), i have expilicity set the combo-box text. other problem is when combo box is in dropped down mode, the first element get selected even if i don't want to . please help if any one has solution:(
-
i am populating combobox on keypress event of the combobox. when three character are pressed, i get for the text so for written in the combobox and search the text in the database, after searching if results are found, combo-box is clear & populated again using a for loop ( since the result after the database query is an ArrayList). Next i do this combox.DroppedDown=true, Now here comes the problem, the selected text (i.e the characters that are written in the combox box are cleared), i have expilicity set the combo-box text. other problem is when combo box is in dropped down mode, the first element get selected even if i don't want to . please help if any one has solution:(
This is the behavior of the ComboBox common control, which the
System.Windows.Forms.ComboBox
class wraps. In order to override this sort of functionality, you should read about the ComboBox common control (in the "User Interface Design and Development" section of MSDN, under "Windows Controls") and extend theComboBox
class in .NET in order to override theWndProc
method and handle the notification messages yourself. Some of this might be possible using managed events, but not everything always is.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----