DataGridView - 聚焦特定单元格 [英] DataGridView - Focus a specific cell

查看:23
本文介绍了DataGridView - 聚焦特定单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 DataGridView 中的任何指定单元格上设置焦点?我期待像 Focus(rowindex,columnindex) 这样的简单方法,但它并不那么容易.

How to set focus on any specified cell in DataGridView? I was expecting a simple way like Focus(rowindex,columnindex) but it is not that easy.

推荐答案

Set the Current Cell like:

Set the Current Cell like:

DataGridView1.CurrentCell = DataGridView1.Rows[rowindex].Cells[columnindex]

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

您可以通过以下方式直接关注

and you can directly focus with Editing by:

dataGridView1.BeginEdit(true)

这篇关于DataGridView - 聚焦特定单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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