打开并通过CheckBox将值从DataGrid传递给Form

时间:2014-03-24 11:01:14

标签: c# wpf checkbox datagridview

我在每条记录中都有一个带有CheckBox列的datagridview。所以,我想要的是,当我点击复选框时,该行的所有信息都会转到一个表格,我可以在记录的信息中制作一些版本。 我的问题是如何才能将信息从DGV传递到表单,只需单击复选框列即可。

有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

尝试这样

 private void dataGridView1_CurrentCellDirtyStateChanged(object sender, EventArgs e)
        {


            if (dataGridView1.CurrentCell.GetType()==typeof(DataGridViewCheckBoxCell)
            && (bool)(dataGridView1.CurrentCell.Value)==true)
          {
                Form2 x =new Form2();
                x.label1.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[1].Value);
                x.Show ();
          }

        }
相关问题