专注于表单加载中的数据网格2号单元 [英] Focus at datagrid cell no 2 on form load

查看:68
本文介绍了专注于表单加载中的数据网格2号单元的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当数据网格加载到事件表单加载中时,我想关注第一条记录的第二个单元格.
我已经尝试过但是失败了:

昏暗的rowToSelect为DataGridViewRow = gvBlockedTreatment.Rows(0)
rowToSelect.Selected = True
rowToSelect.Cells(2).Selected = True
gvBlockedTreatment.CurrentCell = rowToSelect.Cells(2)

该代码在其他情况下正常运行,但在加载表单时却无法正常工作.请提出建议.

问候,
索菲亚

I want focus at second cell of first record when datagrid loads on the event form load.
I have tried this but failed:

Dim rowToSelect As DataGridViewRow = gvBlockedTreatment.Rows(0)
rowToSelect.Selected = True
rowToSelect.Cells(2).Selected = True
gvBlockedTreatment.CurrentCell = rowToSelect.Cells(2)

the code works normal in other event but not on form load.Please suggest.

Regards,
Sofia

推荐答案

索菲亚,
请参考此链接.可能会对您有帮助.
http://www.vbdotnetforums.com/winforms-grids/11313-setting- cell-focus-datagridview.html [ ^ ]
Hi sofia,
Refer this link. It may help you.
http://www.vbdotnetforums.com/winforms-grids/11313-setting-cell-focus-datagridview.html[^]


这篇关于专注于表单加载中的数据网格2号单元的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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