DataGridView Sort Programmatically

前端 未结 2 471
执念已碎
执念已碎 2021-01-25 02:38

I have created my custom DataGridViewNumericTextBoxColumn derived from DataGridViewTextBoxColumn class.

When I call

this.HeaderDataGridView.Sort = Sort.P         


        
相关标签:
2条回答
  • 2021-01-25 03:24

    If you are using a binding source, you can simply set the .Sort property to the name of the column you want to sort on. For example:

    myBS = new BindingSource();
    myBS.DataSource = DataSet.MY_TABLE;
    myBS.Sort = "MY_COLUMN";
    myGrid.DataSource = myBS;
    
    0 讨论(0)
  • 2021-01-25 03:44

    What's the DataSource of the DataGridView? Can the DataSource sort Double values programatically?

    0 讨论(0)
提交回复
热议问题