0
在我嘗試在遇到問題的Winforms中使用DataBinding期間。它看起來像DataSource DataGridView更新後不會刷新數據。無法理解問題出在哪裏。在WinForms中更新BindingSource
var companies = new List<Company> { new Company { Name = "Test", Id = 100 }}
這裏是代碼到DataGridView中的項目列表綁定:
bindingSource1.DataSource = _context.Companies;
dataGridView1.DataSource = bindingSource1.DataSource;
但在那之後,如果我更新companies
列表這樣
companies.Add(new Company { Name = "MDG", Id = 500 });
我找不到新添加到DataGridView中的項目。有人能幫助我理解我錯過了什麼嗎?