日期:2014-05-18  浏览次数:20779 次

C#的datagridview()问题
大概是这样的:
DataSet ds = new DataSet();
DataGridView dataGridView1;
DataView dv;

dv = ds.Tables[1].DefaultView;
dataGridView1.DataSource = dv;

然后在其显示出所读的数据,然后我想把某行中某列的内容显示到文本框中,应该怎么做呢?

------解决方案--------------------
CurrencyManager CM =(CurrencyManager) this.BindingContext[this.names1,"Person"];
this.label1.Text=CM.Position.ToString();
------解决方案--------------------
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
this.textbox1.text=this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
}