通过右键单击datagridview我想编辑我的行。怎么办? [英] By right clicking on datagridview i want to edit my row.How can it be done?

查看:92
本文介绍了通过右键单击datagridview我想编辑我的行。怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用鼠标右键单击编辑我的数据网格。

How can i edit my datagrid using right click of mouse.

推荐答案

使用CellMouseClick事件处理程序,它将触发左/右单击事件...以下代码可能对您有用。



private void dataGridView1_CellMouseClick(object sender,DataGridViewCellMouseEventArgs e)

{



if(e.Button == MouseButtons .Right)

{

dataGridView1.Rows [dataGridView1.CurrentRow.Index] .Cells [姓名]。值=十;

}

}
Use the CellMouseClick event handler which will fire the left/right click event...below following code might useful to you.

private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{

if (e.Button == MouseButtons .Right )
{
dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells["NAME"].Value = "TEN";
}
}


这篇关于通过右键单击datagridview我想编辑我的行。怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆