在加载事件中在 datagridview 中设置当前单元格在 vb.net 中不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18690393/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 15:00:01  来源:igfitidea点击:

setting current cell in datagridview in load event not working in vb.net

vb.netdatagridview

提问by Matthew

This is my code for setting the current cell:

这是我设置当前单元格的代码:

dvFromAlloc.CurrentCell = dvFromAlloc(1, 0)

How ever this is not working in load event, Why is it not working?

这在加载事件中如何不起作用,为什么不起作用?

Thank you for your help

感谢您的帮助

采纳答案by sk2185

You Try this Code

你试试这个代码

DataGridView1.CurrentCell = DataGridView1.Rows[1].Cells[0];

Or Verify this link

或验证此链接

Data Grid View Cell Focused

数据网格视图单元格聚焦

回答by user3223432

DGV.Focus() DGV.CurrentCell = DGV.Rows(0).Cells(2)

DGV.Focus() DGV.CurrentCell = DGV.Rows(0).Cells(2)

回答by Sudhakar MuthuKrishnan

Set the Current Cell :

设置当前单元格:

dvFromAlloc.CurrentCell = dvFromAlloc.Item(1, 5)

or

或者

dvFromAlloc.CurrentCell = dvFromAlloc.Item("ColumnName", 5)

and you can directly focus with Editing by:

您可以通过以下方式直接专注于编辑:

dvFromAlloc.BeginEdit(true)