Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
How can i use a text box with distinctive characters in row with auto complete and drop down be active ?

when in text box , i enter the first distinctive character , I have both auto complete and drop down menu , i mean both of them are active .
But , as soon as i want to add another distinctive character in my text box , none of my auto complete and my drop down menu are active . i mean they don't show themselves. just in the first using show .
With which code , i can make auto complete and drop down active in each stage after distinctive character?

i use platform win form.
Posted
Updated 14-May-11 8:47am
v2

I just tested it — all works correctly.

First of all, there is no "drop-down menu" in TextBox. You can use either ContextMenu or ContextMenuStrip. Maybe, you did not explain properly — drop-down behavior is available with ComboBox.

I tried all these variants (including ComboBox). All for lists are shown of three different ways (ContextMenu or ContextMenuStrip is pretty much the same) and do not interfere in anyway. You can use them all together. For auto-complete feature, I used the following test:

C#
var source = new AutoCompleteStringCollection();
source.AddRange(new string[] {
   "January",
   "February",
   "March",
   "April",
   "May",
   "June",
   "July",
   "August",
   "September",
   "October",
   "November",
   "December"
});
myTextBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
myTextBox.AutoCompleteCustomSource = source;
myTextBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
myTextBox.Text = "Yes!";
myComboBox.Parent = this;
myComboBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
myComboBox.AutoCompleteCustomSource = source;.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
myComboBox.Items.AddRange(new string[] { "One", "Two", "Three", } );
ContextMenuStrip menu = new ContextMenuStrip();
ToolStripDropDownButton item1 = new ToolStripDropDownButton();
ToolStripDropDownButton item2 = new ToolStripDropDownButton();
item1.Text = "Open";
item2.Text = "Save";
menu.Items.AddRange(new ToolStripItem[] { item1, item2, });
myComboBox.ContextMenuStrip = menu;
myTextBox.ContextMenuStrip = menu;


All works correctly, no problems.

—SA
 
Share this answer
 
Comments
Wonde Tadesse 14-May-11 19:31pm    
Good answer.My 5.
Sergey Alexandrovich Kryukov 15-May-11 0:26am    
Thank you, Wonde.
--SA
Kim Togo 15-May-11 2:14am    
Good answer and with code samples. My 5.
Sergey Alexandrovich Kryukov 15-May-11 12:12pm    
Thank you, Kim.
--SA
Thanks . But i don't know how show in the myTextBox -->
August;December;May
 
Share this answer
 
Comments
Wonde Tadesse 14-May-11 19:31pm    
Please look -SA answer properly. He gave you example for textbox as well as combobox.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900