日期:2014-05-18 浏览次数:21325 次
this.comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; this.comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems;
------解决方案--------------------
this.comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
this.comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems;
------解决方案--------------------
private void comboBox1_TextChanged(object sender, EventArgs e) { string str = this.comboBox1.Text; for (int i = 0; i < this.comboBox1.Items.Count; i++) { if (this.comboBox1.Items[i].ToString().IndexOf(str) == 0) { this.comboBox1.Text = this.comboBox1.Items[i].ToString(); this.comboBox1.Select(str.Length, this.comboBox1.Text.Length - str.Length); break; } } }
------解决方案--------------------