按字母类型显示Combobox中的名称列表 [英] Dispaly list of names in Combobox as per type by letters
问题描述
您好,
我必须带一个propertygrid.In必须使用组合框作为Name.by使用arraylist我必须填写组合框中的所有名称od列表。
现在我想通过输入letter来显示列表的名称。列表中的一些人有一些nmaes.If我必须输入字母A,然后在列表中想要显示所有名字从头开始字母A。
怎么做?
我们可以通过propertygrid对combobox创建单独的组合框控件吗?
使用它;
[CategoryAttribute(Button)]< br />
[MergableProperty(false)]< br />
[TypeConverter(typeof(ListNameConverter))]< br />
必须创建组合框n调用arrylisy.through列表填充名称。但是,无法在其中调用key_Down事件。因此无法通过names.how获取属性类中的cal事件列表?
或者我们可以把新的组合框控制放进去了吗?但是在这个问题上有一些与维度相关的问题。
Waht是解决方案吗?
你好
简单方法是:
1.绑定列表
到ComboBox
2.在TextChanged
<$ c的事件$ c> ComboBox :
private void MyComboBox_TextChanged( object sender,EventArgs e)
{
L IST<串GT; myList = // 从数据集中获取或...
< span class =code-keyword> string text =((ComboBox)sender).Text.ToLower();
var names = myList.Where(n = > n.ToLower ().StartsWith(文本));
if (names.Count()> 0 )
{
myList = names.ToList();
// 将MyList重新绑定为组合...
}
}
选择组合框属性< span class =code-keyword>然后
1 。 autocompletemode 选项 选择 suggestappend 选项。
2 。 AutoCompleteSource 选项 选择 Lisititem 选项
Hello,
I have to take one propertygrid.In that have to take combobox as Name.by using arraylist i have to fill all name od list in combobox.
Now i want to display names of list by typing letter.Means suppose in list have some nmaes.If i have to type letter "A",then in list want to show all names which start bye letter "A".
How to do it?
Can we put seperate combobox control on created by combobox through propertygrid?
By using it;
[CategoryAttribute("Button")]<br /> [MergableProperty(false)]<br /> [TypeConverter( typeof( ListNameConverter ) )]<br />
have to create combobox n call arrylisy.through list fill name.But,not able to call key_Down Event in it.So not able to get list of names by names.how to cal event in property class??
Or can we put new combobox control in it?But in this occuered some problem related to dimensions n all.
Waht is the the solution?
Hello
Simple way is:
1. Bind aList
toComboBox
2. InTextChanged
event ofComboBox
:
private void MyComboBox_TextChanged(object sender, EventArgs e) { List<string> myList = //Get it from a dataset or ... string text = ((ComboBox)sender).Text.ToLower(); var names = myList.Where(n => n.ToLower().StartsWith(text)); if (names.Count() > 0) { myList = names.ToList(); //rebind MyList to combo ... } }
select combo box property then 1. autocompletemode option select suggestappend option. 2. AutoCompleteSource option select Lisititem option
这篇关于按字母类型显示Combobox中的名称列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!