-1

我有方法

private void getValues(object sender, EventArgs e)
    {
        int id = int.Parse(dgvTable.Rows[dgvTable.CurrentRow.Index].Cells[0].Value.ToString());
        var values = from c in v.db.TotalDoc
                     where c.TotalID == id
                     select c.TotalAmount;
        dgvValues.DataSource = values;
    }

和这一行的datagridview“dgvTable”错误

dgvTable.CellClick += new EventHadler(getValues);

错误文本是:“getValues”没有重载与委托“System.EventHandler”匹配

请帮忙!

4

2 回答 2

2

DataGridView.CellClick方法签名是 a而DataGridViewCellEventHandler不是 type EventHandler。将您的方法签名更改为:

private void getValues(object sender, DataGridViewCellEventArgs e)

并将您的声明更改为:

dgvTable.CellClick += new DataGridViewCellEventHandler(getValues);
于 2012-04-05T17:26:15.770 回答
2
private void getValues(object sender, DataGridViewCellEventArgs e)
于 2012-04-05T17:26:24.500 回答