【问题标题】:How to sum a column in Window application datagridview如何在Window应用程序datagridview中对一列求和
【发布时间】:2020-11-03 15:47:37
【问题描述】:

我的订单表有以下模型类

public class OrdersModel
    {
        public int id { get; set; }
        public int CustomerId { get; set; }
        public string Name { get; set; }
        public int NoOfClothes { get; set; }
        public int Price { get; set; }
        public int AdvancePayment { get; set; }
        public DateTime OrderDate { get; set; }
        public DateTime ReturnDate { get; set; }
        public int SuitQty { get; set; }
        public OrdersModel()
        {

        }

我填充网格,效果很好。我想对 AdvancePayment 和 Price 列求和,以显示在文本框中或最后一行。下面是我填充网格的代码。

 DataGridViewRow row = dataGridView1.CurrentRow;
            var CustomerId = int.Parse(row.Cells[0].Value.ToString());
            List<OrdersModel> Orders = GlobalConfig.Connections.GetAllCustomerOrders(CustomerId);
            
            ordersModelBindingSource.DataSource = Orders;

我搜索它,但我找不到解决方案。

【问题讨论】:

    标签: c# datagridview


    【解决方案1】:

    对不起,还不能写评论,但你的问题看起来很像这个:https://stackoverflow.com/a/3779753/14569944

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-08-31
      • 1970-01-01
      • 2021-06-30
      • 2014-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多