加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

DataGridViewButtonColumn的使用方法

(2013-03-14 21:45:05)
标签:

it

分类: C#.NET

DataGridViewButtonColumn的使用方法

http://e.hiphotos.baidu.com/album/pic/item/7dd98d1001e939014d2aa8b27bec54e736d19615.jpg设置DataGridViewButtonColumn,然后在dataGridView1里的 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArge)事件里写相应的执行代码,因为每点一次dataGridView1的button键都会触发private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArge)事件。比如在button键在第二列,当点击button键时,弹出MessageBox框出来,代码如下:

if (e.ColumnIndex ==1 )
            {
             MessageBox.Show("不能删除最后一行新增行。");

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有