把DataGridview控件对应行选中光标就可以实现上下移动吧,每一行都有一个属性表示该行是否被选中了[设置了DataGridview控件每次只能够单选一行记录]
解决方案 »
- 下载等!!!没见过这个是什么!!!!求帮忙
- 聚合参数中的语法错误: 需要具有可能的“Child”限定符的单个列参数
- C# 在类文件中调用ocx控件,引发System.Windows.Forms.AxHost异常,求助
- 关于C#打印的问题,请赐教,谢谢
- ASP.NET 在郵件中如何提交HTML表單到ASPX頁
- 接受视频信号
- 怎样拖动TabControl的TabPage文本那块区域到另外一个TabPage上,即相互交换位置(WinForm)
- 未能获取此实现的CryptoApi加密服务程序(CSP),急!!!
- 读含有中文的文本,读出来是乱码,请问怎么解决阿?急急急
- 用jmail如何判断接收到邮件的状态(已读\未读)
- 大家来看看是不是 DataGridView 的bug
- 求助WinCE程序内存不足怎么办?
private void button3_Click(object sender, EventArgs e)
{
if (dataGridView1.Rows.Count > 0)
{
if (dataGridView1.CurrentCell.RowIndex != dataGridView1.Rows.Count - 1)
{
int last = dataGridView1.SelectedRows[0].Index;
dataGridView1.CurrentCell = dataGridView1.Rows[last + 1].Cells[1];
}
else
{
dataGridView1.CurrentCell = dataGridView1.Rows[0].Cells[1];
}
}
}//------------------下一条
private void button11_Click(object sender, EventArgs e)
{
try
{
if (dataGridView1.CurrentCell.RowIndex != 0)
{
int last = dataGridView1.SelectedRows[0].Index;
dataGridView1.CurrentCell = dataGridView1.Rows[last - 1].Cells[1];
}
else
{
dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[1];
}
}
catch { }
}