DataGridViewComboBoxColumn点击下拉事件(VB.NET)

DataGridViewComboBoxColumn点击下拉事件(VB.NET)

创建一个DataGridView1控件,在DataGridView中添加列类型为“DataGridViewComboBoxColumn”,名称为“ComboBoxName”。然后在DataGridView中添加CellEnter事件处理程序。代码如下:

    'CellEnter  DataGridView单击打开下拉框
    Private Sub DataGridView1_CellEnter(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellEnter
        Dim dgv As DataGridView = CType(sender, DataGridView)
        If dgv.Columns(e.ColumnIndex).Name = "ComboBoxName" AndAlso TypeOf dgv.Columns(e.ColumnIndex) Is DataGridViewComboBoxColumn Then
            SendKeys.Send("{F4}")
        End If
    End Sub

你可能感兴趣的:(VB.NET,.net)