Datagridview自动行选择/重点开始后形式

问题描述:

进出口好奇,如果有一种方式,我可以让我dataGridView1自动选择第一行后形式是startedloadedDatagridview自动行选择/重点开始后形式

我在C#begginner我认为它可以专注于第一行dataGridView1

非常感谢您的帮助!

+0

我认为这是默认行为。 – 2013-07-04 21:55:11

+0

嗯,我认为它不是,我想设置这样的事情:启动或加载窗体后,选择datagridview1中的第一行,使我的键盘焦点,并选择第一行datagridview1。 – Marek

+0

你有没有试过datagridview1.Focus? – OCDan

表单中的负荷,如果你已经初始化datagridview(添加数据),将本:

dataGridView1.Rows[yourindex].Selected = true; 

记住,如果你把例如3行,你可以把指数高达2 。 你的情况(您想第一行)指数为0。

编辑:

设置选择箭头:

dataGridView1.CurrentCell = dataGridView1.Rows[0].Cells[0]; 
+0

@MarekŠíp,设置'DataGridView.CurrentCell'属性 – 2013-07-04 22:59:47

+0

我该怎么做?我无法找到像CurrentCell这样的房产:/ – Marek

+0

对不起马瑞克我离开了,只是看到你的第二个问题,并编辑它。 – terrybozzio