How to get dragged column in datagridview when All

2019-09-09 05:05发布

I have a windows form application in which i have a datagridview with AllowUserToOrderColumns = true, then user change column order via drag and drop.

How can i know which column is dragged ?

1条回答
Anthone
2楼-- · 2019-09-09 05:27

When you set AllowUserToOrderColumns = true then you will know the column name in ColumnDisplayIndexChanged

Private Sub Datagridview1_ColumnDisplayIndexChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewColumnEventArgs) Handles dgvGuru.ColumnDisplayIndexChanged

     MsgBox(e.Column.Name)

End Sub
查看更多
登录 后发表回答