如何使DataGridView中显示选定的行? [英] How do I make the DataGridView show the selected row?

查看:234
本文介绍了如何使DataGridView中显示选定的行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要强制的DataGridView显示所选行。总之,我必须改变基于什么键入到框中选择DGV一个文本框。当发生这种情况时,选择更改为匹配行。不幸的是,如果选择的行出来的观点,我必须手动向下滚动找到选择。有谁知道如何强制DGV显示选定的行?

I need to force the DataGridView to show the selected row. In short, I have a text box that changes the DGV selection based on what is typed into the box. When this happens, the selection changes to the matching row. Unfortunately if the selected row is out of the view, I have to manually scroll down to find the selection. Does anyone know how to force the DGV to show the selected row?

谢谢!

推荐答案

您可以设置:

dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.SelectedRows[0].Index;

下面是的MSDN文档这个属性。

这篇关于如何使DataGridView中显示选定的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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