如何在datagridview c#中将焦点设置到特定单元格 [英] how to set focus to a particular cell in datagridview c#

查看:738
本文介绍了如何在datagridview c#中将焦点设置到特定单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨天才,



我使用以下代码专注于datagridview中的特定单元格。

Hi Genius,

I am using the following code to focus to a particular cell in datagridview.

private void dgOrderDetails_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
   if (dgOrderDetails.Columns[e.ColumnIndex].Name.ToString().ToUpper() == "BILLINGMONT")
   {
     dgOrderDetails.Focus();
     dgOrderDetails.CurrentCell = dgOrderDetails[dgOrderDetails.CurrentCell.ColumnIndex + 1, dgOrderDetails.CurrentCell.RowIndex];
   }
}



但是我的数据网格光标没有绑定我想要的地方。我的英语。



请给我一个解决方案。


but my data grid cursor is not binding where i am expecting.Sorry for my English.

Please provide me a solution.

推荐答案

你需要做类似的事情:
dataGridView1.CurrentCell = dataGridView1.Rows[rowindex].Cells[columnindex];



另请参阅一些替代方案:

How-set-focus-cell-datagridview-using-C.aspx [ ^ ]

以编程方式给予焦点到特定单元格数据网格视图 [ ^ ]


grdUser.CurrentCell = grdUser.Rows[e.RowIndex].Cells[2];
                    grdUser.CurrentCell.Selected = true;
                    e.Cancel = true;


推荐此链接



DataGridView - 聚焦特定单元格 [ ^ ]



问候.. :)
Refer this link

DataGridView - Focus a specific cell[^]

Regards..:)


这篇关于如何在datagridview c#中将焦点设置到特定单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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