DataGridView中 - 聚焦于特定的细胞 [英] DataGridView - Focus a specific cell

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

问题描述

如何将焦点设置在DataGridView中的指定单元格?我期待像对焦(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.

推荐答案

设置,如当前单元格

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天全站免登陆