Strange issue with a datagridview and a tabcontrol C#

后端 未结 2 1717
我在风中等你
我在风中等你 2020-12-10 23:13

I have a strange problem. I have a TabControl with two TabPages. Each page has a datagridview. Both datagridviews are pop

相关标签:
2条回答
  • 2020-12-10 23:29

    This is because a data-bound control(dataGridView2) is not updated until the control is made visible. See this. You can refresh the binding, for example, by programmatically switching to TabPage2 and back to the first tab.

    0 讨论(0)
  • 2020-12-10 23:37

    THe only thing I can se at the moment is that you are not doing this on tabpage 2

    dataGridView1.Sort(dataGridView1.Columns[1], ListSortDirection.Ascending);
    

    try

    dataGridView2.Sort(dataGridView2.Columns[1], ListSortDirection.Ascending);
    
    0 讨论(0)
提交回复
热议问题