[英]Check if a new row is added to a DataGridView
我从我的服务器下载数据并使用DataGridView
来呈现结果。 添加新行时,我希望我的程序显示一个信号。 我怎样才能做到这一点?
订阅DataGridView.RowsAdded
事件。
dataGridView1.RowsAdded += new DataGridViewRowsAddedEventHandler(dataGridView1_RowsAdded);
void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
{
// show the signal
}
您需要使用 userAddedRow 事件,当激活该事件时,您可以使用它来发送像 true 或 false 这样的布尔值,例如这个示例
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;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.