How to get dragged column in datagridview when AllowUserToOrderColumns = true

时光毁灭记忆、已成空白 提交于 2019-12-12 04:52:09

问题


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:


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


来源:https://stackoverflow.com/questions/17022205/how-to-get-dragged-column-in-datagridview-when-allowusertoordercolumns-true

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!