c# dataGridView提取问题
来源:百度知道 编辑:UC知道 时间:2024/06/06 13:30:30
直接赋值,for (int i = 0; i < dataGrid1.Rows.Count; i++)
{
if (dataGrid1.Rows[i].Selected)
{
xx = dataGrid1.Rows[i].Cells[0].Value.ToString();
}
this.textBox1.Text = xx;
在dataGridView事件选CellContentClick加入下面代码:
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
string strSeletc = this.dataGridView1.CurrentRow.Cells[e.ColumnIndex].Value.ToString();
this.textBox3.Text = strSeletc;
}
在dataGridView1_CellClick事件下写代码
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
string ss = this.dataGridView1.Rows[e.RowIndex].Cells["ckname"].EditedFormattedValue.ToSt