【问题标题】:Non-invocable member 'datagirdview.Rows' cannot be used like a method不可调用的成员“datagridview.Rows”不能像方法一样使用
【发布时间】:2016-12-08 09:44:52
【问题描述】:

在我的 C# windows 窗体中,我有一个列按钮,我想点击一下我得到 gridview 的一些特定列

代码如下:

 private void attack_History_ViewDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            attack_History_ViewDataGridView.Rows(e.RowIndex).Cells(0);
        }

不幸的是,在Rows 中,它抱怨:

Non-invocable member 'datagirdview.Rows' cannot be used like a method

【问题讨论】:

    标签: c#


    【解决方案1】:

    如果要访问行集合中的项目,则必须使用索引器,该索引器使用方括号 ([]) 完成。同样适用于Cells

    attack_History_ViewDataGridView.Rows[e.RowIndex].Cells[0];
    

    【讨论】:

      猜你喜欢
      • 2013-08-10
      • 2013-07-07
      • 1970-01-01
      • 1970-01-01
      • 2017-04-11
      • 2016-05-01
      • 2016-04-11
      • 2018-05-31
      • 1970-01-01
      相关资源
      最近更新 更多