Adding rows programatically to a DataGridView that is data bound?

后端 未结 2 1149
逝去的感伤
逝去的感伤 2020-12-12 02:01

I have a problem and I can\'t seem to be able to solve it. I thought someone here will be able to help out.

I have a form that has a DataGridView of customers. Now,

2条回答
  •  渐次进展
    2020-12-12 02:27

    Bind your DGV to a BindingList, where YourObject can be a simple class with properties reflecting your database schema. Initially populate the BindingList from the database, and the DGV will automatically add YourObject instances to the list. When you're ready to commit the changes, do so manually from the BindingList.

提交回复
热议问题