【发布时间】:2021-08-02 17:32:26
【问题描述】:
当用户搜索特定项目时,我希望应用程序选择并单击第一行。目前,应用程序仅突出显示第一行,但不确定如何以编程方式单击一行。 代码:
target.Rows[0].Selected = true;
【问题讨论】:
-
你也可以写:
DataGridView.CurrentCell = target.Rows[0].Cells[0]; -
target.Rows[0].Cells[0].Selected = true; -
同时添加 Grid.CurrentCell = Grid.Rows(0).Cells(0) Grid.Rows(0).Selected = True