comboBox和textBox支持内置的搜索提示功能,
在form的InitializeComponent()中添加如下语句:
this.comboBox1.AutoCompleteCustomSource.AddRange(new string[] { "10.152.154.89", "10.152.154.90", "10.152.252.10", "10.152.252.11" });//是将数据添加到搜索范围
//默认是None,还有Append,和SuggestAppend属性,除了默认的None都可以实现搜索提示的功能
this.comboBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.comboBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
转自http://www.cnblogs.com/luomingui/archive/2010/03/17/1688188.html
时间: 2024-10-23 15:29:01