How to manually drop down a DataGridViewComboBoxColumn?

前端 未结 7 1518
清酒与你
清酒与你 2020-12-01 14:20

I have a DataGridView with one DataGridViewComboBoxColumn in my WinForms application. I need to drop down (open) this DataGridViewComboBoxColumn manually, let\'s say after a

7条回答
  •  攒了一身酷
    2020-12-01 14:44

    I know this can't be the ideal solution but it does create a single click combo box that works within the cell.

       Private Sub cell_Click(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
            DataGridView1.BeginEdit(True)
            If DataGridView1.Rows(e.RowIndex).Cells(ddl.Name).Selected = True Then
                DirectCast(DataGridView1.EditingControl, DataGridViewComboBoxEditingControl).DroppedDown = True
            End If
        End Sub
    

    where "ddl" is the combobox cell I added in the gridview.

提交回复
热议问题