
private void toolStripMenuItem_Click(object sender, EventArgs e)
{
DataGridView dv = sender as DataGridView
if (dv != null &&dv.CurrentCell!=null &&dv.CurrentCell.RowIndex!=-1)
{
dv.Rows.RemoveAt(dv.CurrentCell.RowIndex)
}
}
先在Form中添加个contextMenuStrip控件 然后指定DataGridView的ContextMenuStrip属性为刚刚添加的contextMenuStrip1控件就可以了欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)