下面是使用ComboBox 测试
- private void FormTest_Load(object sender, EventArgs e)
- {
- DataTable dt = new DataTable();
- dt.Columns.Add("Name");
- dt.Columns.Add("VV");
- dt.Rows.Add(new string[] { "你好", "c" });
- dt.Rows.Add(new string[] { "大家", "d" });
- dt.Rows.Add(new string[] { "你很好", "e" });
- dt.Rows.Add(new string[] { "你不好", "f" });
- this.comboBox1.DataSource = dt;
- this.comboBox1.DisplayMember = "Name";
- this.comboBox1.ValueMember ="VV";
- this.comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems;
- this.comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
- }