首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

用按钮实现datagridveiw中的下上箭头移动选择行功能

2012-08-15 
用按钮实现datagridveiw中的上下箭头移动选择行功能两个按钮“上一条” 实现选择行上移“下一条” 实现选择行

用按钮实现datagridveiw中的上下箭头移动选择行功能
两个按钮 
“上一条” 实现选择行上移 
“下一条” 实现选择行下移

不需要交换数据 

就像 delphi 中的数据导航条


[解决办法]

dataGridView1.Rows[dataGridView1.CurrentRow.Index + 1].Selected = true;

dataGridView1.Rows[dataGridView1.CurrentRow.Index - 1].Selected = true;

注意自己判断一下是否到顶到底,以免访问越界

热点排行