我想以编程方式选择/突出显示按钮单击的整列,以便让用户知道他们搜索的内容。DataGridView:以编程方式选择/突出显示按钮单击的整个列
This is what currently happens on button click ("GO" button) 但this是我需要发生的事情。
到目前为止,我还尝试了这些无济于事: DataGridView2.SelectionMode = DataGridViewSelectionMode.FullColumnSelect DataGridView2.Columns(2).Selected = True
这样做给了我这个错误:DataGridView control's SelectionMode cannot be set to FullColumnSelect while it has a column with SortMode set to DataGridViewColumnSortMode.Automatic.
我也试图简单地选择整列。没有错误,但没有奏效。 DataGridView2.Columns(2).Selected = True
请你详细说明我该怎么做?谢谢.. – austin
@austin遍历每一行,将所需单元格的“Selected”属性设置为“True”。 – OhBeWise
啊,好的。我改变了我用来搜索我的问题的答案的关键字..我终于找到了一些类似的线程。谢谢 – austin