我需要从我的 DataGridView 中删除选定的行。目前我设法执行了选择命令,但我不知道用什么代码继续删除/删除选定的行。
我使用的代码是:
(refTofrPlanMain.dGVPlan.DataSource as DataTable).DefaultView.RowFilter = string.Format("Vodic = '{0}'", searchTBoxW.Text);
foreach (DataGridViewRow item in refTofrPlanMain.dGVPlan.Rows)
{
if (item.Visible)
{
item.Selected = true;
break;
}
//...
//Other code
//...
}
其中: - refTofrPlanMain 表示对 Form1 的引用(我在 Form2 中工作) - dGVPlan 是 DataGridView。
谢谢您的支持。