FullRowSelect
this.dataGridView1.SelectionMode=System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
string str = "";
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
str += "," + dataGridView1.Rows[i].Cells["cityDataGridViewTextBoxColumn"].FormattedValue.ToString().Trim();
}
str = str.Substring(1);
this.textBox2.AutoCompleteCustomSource
.AddRange(str.Split(','));
textBox2.AutoCompleteMode = AutoCompleteMode.Suggest;
textBox2.AutoCompleteSource = AutoCompleteSource.CustomSource;
//首先声明数据源
//AutoCompleteStringCollection myCompleteSource = new AutoCompleteStringCollection();
////对数据源添加数据
//foreach (DataRow dr in MyTable.Rows)
//{
// myCompleteSource.Add(dr["ArticleNo"].ToString());
//}
////设置TextBox属性
//txtKeyWord.AutoCompleteMode = AutoCompleteMode.Suggest;
//txtKeyWord.AutoCompleteSource = AutoCompleteSource.CustomSource;
////绑定数据源
//txtKeyWord.AutoCompleteCustomSource = myCompleteSource;
//foreach (DataGridViewRow dgvR in dgv.Rows)
//{
// ((DataRowView)dgvR.DataBoundItem).Delete();
//}