DataGridView中显示了很多数据后,我点选某一个之后,如何让其ID值显示在一个textBox中(注:我要根据此ID进行数据更新),求大虾指点。

解决方案 »

  1.   


            private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
            {
                textBox1.Text = dataGridView1.Rows[e.RowIndex].Cells["ID"].Value.ToString();
            }
      

  2.   

    private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
            {
                textBox1.Text = dataGridView1.Rows[e.RowIndex].Cells["ID"].Value.ToString();
            }
      

  3.   

    private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
            {
                textBox1.Text = dataGridView1.Rows[e.RowIndex].Cells["ID"].Value.ToString();
            }这个就行了