问题描述
我如何在具有自动完成功能的下拉框中使用具有独特字符的文本框,并使其处于活动状态?
在文本框中,当我输入第一个独特字符时,我同时具有自动完成和下拉菜单,这意味着它们都处于活动状态.
但是,一旦我想在文本框中添加另一个独特的字符,我的自动完成功能和下拉菜单都不会处于活动状态.我的意思是他们不露面.就在第一个使用show的时候.
使用哪个代码,我可以使自动完成和在出现独特字符后的每个阶段处于活动状态?
我使用平台获胜表格.
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.
推荐答案
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.
这篇关于在一行中使用分隔符的自动完成文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!