110,534
社区成员
发帖
与我相关
我的任务
分享
我当时的困惑是 如何 才能 判断 当前点击的那一列cheeckbox 并且 为 true
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
//判断列是否是CheckBox类型
//如果你知道是第几列,也可以用e.ColumnIndex == 0来判断
if (this.dataGridView1.Columns[e.ColumnIndex] is DataGridViewCheckBoxColumn)
{
//checkbox选中
if (this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString() == "True")
{
}
}
}
把选中的行放入dataTable中var q = from p in dt.AsEnumerable() group p by p.currency into g select new { g.Key, TotalPrice1 = g.Sum(p => p.Price1), TotalPrice2 = g.Sum(p => p.Price2) };
把选中的行放入dataTable中var q = from p in dt.AsEnumerable() group p by p.currency into g select new { g.Key, TotalPrice1 = g.Sum(p => p.Price1), TotalPrice2 = g.Sum(p => p.Price2) };
var q =
from p in dt.AsEnumerable()
group p by p.currency into g
select new {
g.Key,
TotalPrice1 = g.Sum(p => p.Price1),
TotalPrice2 = g.Sum(p => p.Price2)
};