给DataGridView 添加鼠标单击事件,并且在contexMenutstrip中显示,获取该行的主键
2015-04-09 08:52
405 查看
private void dataGridViewEx1_MouseClick(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Right)
{
contextMenuStrip3.Show(dataGridViewEx1, 0, e.Y);
}
}
private void toolStripMenuItem_Delete_Click(object sender, EventArgs e)
{
if(MessageBox.Show("确定要删除该条记录吗?","提示",MessageBoxButtons.YesNo)==DialogResult.Yes) //messbox的show方法的使用
{
int MXid = DbUtils.GetInt(dataGridViewEx1.CurrentRow.Cells[0].Value.ToString());
//右键点击所在的行
DAL.TorchLabQuery.DeleteMXid(MXid);
}
BindGridMX(tb_RN.Text);
}
{
if(e.Button==MouseButtons.Right)
{
contextMenuStrip3.Show(dataGridViewEx1, 0, e.Y);
}
}
private void toolStripMenuItem_Delete_Click(object sender, EventArgs e)
{
if(MessageBox.Show("确定要删除该条记录吗?","提示",MessageBoxButtons.YesNo)==DialogResult.Yes) //messbox的show方法的使用
{
int MXid = DbUtils.GetInt(dataGridViewEx1.CurrentRow.Cells[0].Value.ToString());
//右键点击所在的行
DAL.TorchLabQuery.DeleteMXid(MXid);
}
BindGridMX(tb_RN.Text);
}
相关文章推荐
- 页面中插入flash,并且给flash添加单击事件控制播放,以及获取相关参数.
- DataGridViewButtonColumn添加单击事件
- 单文档(SDI)视图类中手动添加的CListCtrl响应鼠标单击事件!
- Swing添加鼠标右键菜单单击选择监听,并显示右键菜单
- 为鼠标移动事件添加新的功能-让菜单决定是否显示
- unity3d canvas button 代码添加鼠标单击/触摸单击触发事件
- U6数据导出工具项目总结三 鼠标单击或者双击DataGridView控件时获取鼠标点击位置的值
- mapabc高德地图显示多个点,并且每个marker点可以响应鼠标点击事件,处理跳转页面
- 关于Android查询本地视频文件、获取缩略图,并且让缩略图以相同大小显示、给缩略图添加白色边框效果
- 获取鼠标点击事件并显示相对横轴纵轴坐标
- Flash AS3 显示对象对鼠标单击,双击,拖拽事件的处理
- 有其它方法在对话框背景图片 指定区域添加鼠标单击响应事件
- DataGridView单元格单击事件,显示记录到控件
- 发现:Click事件也能获取鼠标单击的坐标
- C#JS动态添加事件,并且获取触发事件的当前node元素
- Gridview模板列中控件的单击事件获取主键ID
- gridview鼠标双击事件(跳转至新页面并传值)单击获取值
- dataGridView单击事件中,显示数据的读取+性别或是状态的读取
- ASP.NET GridView鼠标停留变色,行单击显示详细记录的事件处理
- 为鼠标移动事件添加新的功能-在状态栏显示鼠标坐标