编程设定记录指针在C#的DataGridView [英] Programmatically setting the record pointer in a C# DataGridView

查看:107
本文介绍了编程设定记录指针在C#的DataGridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何编程设置在C#的DataGridView记录指针?

How do I programmatically set the record pointer in a C# DataGridView?

我已经试过DataGridView.Rows [DesiredRowIndex] .Selected = TRUE;,这是行不通的。它所做的就是突出了网格内的行;没有关系没有记录指针移动到该行。

I've tried "DataGridView.Rows[DesiredRowIndex].Selected=true;", and that does not work. All it does is highlight that row within the grid; it doesn not move the record pointer to that row.

推荐答案

要更改活动行的数据网格需要数据网格的当前单元格属性上设置为非隐藏的非残疾,无头单元格您所选择的行。你会做这样的:

To change the active row for the datagrid you need to set the current cell property of the datagrid to a non-hidden non-disabled, non-header cell on the row that you have selected. You'd do this like:

dataGridView1.CurrentCell = this.dataGridView1[YourColumn,YourRow];

确保细胞相匹配的上述标准。更多信息可以在这里找到:

Making sure that the cell matches the above criteria. Further information can be found at:

http://msdn.microsoft.com/en-us/library/ yc4fsbf5.aspx

这篇关于编程设定记录指针在C#的DataGridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆