Selecting a row in DataGridView programmatically

后端 未结 8 2324
被撕碎了的回忆
被撕碎了的回忆 2020-12-08 12:58

How can I select a particular range of rows in a DataGridView programmatically at runtime?

相关标签:
8条回答
  • 2020-12-08 13:22

    In Visual Basic, do this to select a row in a DataGridView; the selected row will appear with a highlighted color but note that the cursor position will not change:

    Grid.Rows(0).Selected = True
    

    Do this change the position of the cursor:

    Grid.CurrentCell = Grid.Rows(0).Cells(0)
    

    Combining the lines above will position the cursor and select a row. This is the standard procedure for focusing and selecting a row in a DataGridView:

    Grid.CurrentCell = Grid.Rows(0).Cells(0)
    Grid.Rows(0).Selected = True
    
    0 讨论(0)
  • 2020-12-08 13:25

    Try This:

    datagridview.Rows[currentRow].Cells[0];
    
    0 讨论(0)
提交回复
热议问题