我有方法
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'
请帮忙!
答案 0 :(得分:2)
DataGridView.CellClick
方法签名是DataGridViewCellEventHandler
,而不是EventHandler
类型。将您的方法签名更改为:
private void getValues(object sender, DataGridViewCellEventArgs e)
并将您的声明更改为:
dgvTable.CellClick += new DataGridViewCellEventHandler(getValues);
答案 1 :(得分:2)
private void getValues(object sender, DataGridViewCellEventArgs e)