【问题标题】:Check if a new row is added to a DataGridView检查是否将新行添加到 DataGridView
【发布时间】:2014-04-14 10:54:11
【问题描述】:

我从我的服务器下载数据并使用DataGridView 来呈现结果。添加新行时,我希望我的程序显示一个信号。我该怎么做?

【问题讨论】:

    标签: mysql vb.net winforms datagridview


    【解决方案1】:

    订阅DataGridView.RowsAdded 活动。

    dataGridView1.RowsAdded += new DataGridViewRowsAddedEventHandler(dataGridView1_RowsAdded);
    
    void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
    {
        // show the signal
    }
    

    【讨论】:

    • 非常感谢!@Junaith
    【解决方案2】:

    您需要使用 userAddedRow 事件,当激活该事件时,您可以使用它来发送 boolean like true or false like this Example

     private void usersDGV_UserAddedRow(object sender, DataGridViewRowEventArgs e)
      {
         //this event occurs when user added new row to the datagridview 
         //and will turn the boolean newRowAdded on.
               newRowAdded = true;
      }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多