DataGridView bound to BindingList does not refresh when value changed

后端 未结 5 423
独厮守ぢ
独厮守ぢ 2020-12-05 07:47

I have a DataGridView bound to a BindingList (C# Windows Forms). If I change one of the values in an item in the list it does not immediately show up in the grid. If I click

5条回答
  •  萌比男神i
    2020-12-05 08:31

        private void refreshDataGrid()
        {
            dataGridView1.DataSource = typeof(List<>);
            dataGridView1.DataSource = myBindingList;
            dataGridView1.AutoResizeColumns();
            dataGridView1.Refresh();
        }
    

    Then, just call for the refreshDataGrid Method anytime a change occurs to your list.

提交回复
热议问题