DataGridView ,DataGridViewButtonColumn如何添加 onclick事件

Tommy_Yu2 2008-10-19 08:48:37
使用DataGridViewButtonColumn 列,可以在单元格内显示按钮。如果你要为用户操作特定行提供一种简单的方式,Button列会很有用,比如排序或在另一个窗体中显示子表记录。


我要问的是:如何简单的添加onclick事件(动态添加的按钮).
...全文
807 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
灰阶 2011-09-05
  • 打赏
  • 举报
回复
受教了 我也遇上差不多的问题
starrysky926 2011-07-24
  • 打赏
  • 举报
回复
void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)

{

if (e.ColumnIndex ==

this.dataGridView1.Columns["ButtonColumn"].Index)

{

if(MessageBox.Show("Do you really want to download this file",

"Download confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)

{

//...

}

}

}

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧