[英]winform C# DataGridView How to Update Columns bound to Generic List
目前我有一個綁定到通用列表的 DataGridView。 所以我有:
dataGridView1.DataSource = ProductBO.GetProducts();
這顯示了大約 300 種產品,並且需要能夠在需要時更新價格和數量列。 什么是最簡單/最干凈的方法? 必須有一些事件喜歡使用 txtPrice_AfterUpdate() 可以使用。 來自 Webform backgraound 和 MS Access 我不確定要走的路線。 提前致謝。
除非這是一個非常昂貴的操作,否則您可以只刷新 DataSource,再次調用該代碼。
public void RefreshProducts()
{
dataGridView1.DataSource = ProductBO.GetProducts();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.