How can I fill a Combobox while writing?
-
I have a Combobox with a few items. Now i will start writing in the Combobox and then only the items who fits with my writing should be shown... for example in my Combobox are These items: "Summer, Sunshine, Winter" so if i do nothing, all should be shown if i write an "S" only "summer" and "sunshine" should be shown if i write an "Su" only "summer" and "sunshine" should be shown and if i write "Sum" only "Summer" should be shown can anyone help me please?
-
I have a Combobox with a few items. Now i will start writing in the Combobox and then only the items who fits with my writing should be shown... for example in my Combobox are These items: "Summer, Sunshine, Winter" so if i do nothing, all should be shown if i write an "S" only "summer" and "sunshine" should be shown if i write an "Su" only "summer" and "sunshine" should be shown and if i write "Sum" only "Summer" should be shown can anyone help me please?
You have to try autocompletetextbox. Auto Complete Textbox[^] Auto Complete Textbox with JQuery[^]
Pankaj Maurya Sr. Software Engineer Gurgaon, India
-
I have a Combobox with a few items. Now i will start writing in the Combobox and then only the items who fits with my writing should be shown... for example in my Combobox are These items: "Summer, Sunshine, Winter" so if i do nothing, all should be shown if i write an "S" only "summer" and "sunshine" should be shown if i write an "Su" only "summer" and "sunshine" should be shown and if i write "Sum" only "Summer" should be shown can anyone help me please?
Long story short, you need to implement this yourself. For Winforms: 1. you need to keep a list of all items (originally found in the combo) 2. look for the text the user types (listed for combo's TextUpdate event) 3. recreate the combo's items, based on what the user typed; very likely, you will need to also "reopen" the combo (that is, set its
DroppedDown
to true) Best, John-- LogWizard Meet the Log Viewer that makes monitoring log files a joy!
-
You have to try autocompletetextbox. Auto Complete Textbox[^] Auto Complete Textbox with JQuery[^]
Pankaj Maurya Sr. Software Engineer Gurgaon, India
1. He was asking for a combo. 2. He was asking in c#.
-- LogWizard Meet the Log Viewer that makes monitoring log files a joy!
-
I have a Combobox with a few items. Now i will start writing in the Combobox and then only the items who fits with my writing should be shown... for example in my Combobox are These items: "Summer, Sunshine, Winter" so if i do nothing, all should be shown if i write an "S" only "summer" and "sunshine" should be shown if i write an "Su" only "summer" and "sunshine" should be shown and if i write "Sum" only "Summer" should be shown can anyone help me please?
You have to try Autocomplete Combobox[^] Or You can try
this.comboBox1.AutoCompleteCustomSource.AddRange(new string[] {"summer", "sunshine", "Winter"});
this.comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
this.comboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;Pankaj Maurya Sr. Software Engineer Gurgaon, India
-
Long story short, you need to implement this yourself. For Winforms: 1. you need to keep a list of all items (originally found in the combo) 2. look for the text the user types (listed for combo's TextUpdate event) 3. recreate the combo's items, based on what the user typed; very likely, you will need to also "reopen" the combo (that is, set its
DroppedDown
to true) Best, John-- LogWizard Meet the Log Viewer that makes monitoring log files a joy!
Thats my Problem, i can't set the items originally in the Combo, i have to fill the Combo while the code is running.
-
You have to try Autocomplete Combobox[^] Or You can try
this.comboBox1.AutoCompleteCustomSource.AddRange(new string[] {"summer", "sunshine", "Winter"});
this.comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
this.comboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;Pankaj Maurya Sr. Software Engineer Gurgaon, India
yeah it works thank you very much!
-
Thats my Problem, i can't set the items originally in the Combo, i have to fill the Combo while the code is running.
1. Note: Pankamauria's second solution might work - I have not used it before though. 2. The combo can be emptied and filled while the code is running - that should not be an issue. Best, John
-- LogWizard Meet the Log Viewer that makes monitoring log files a joy!
-
yeah it works thank you very much!
your welcome...
Pankaj Maurya Sr. Software Engineer Gurgaon, India