Bindingsource is not suspending binding

前端 未结 1 1006
深忆病人
深忆病人 2020-12-07 06:03

I have a form that displays custom details, one section being a list of bank accounts associated with the customer. This list is bound to it\'s own bindingsource, so when lo

相关标签:
1条回答
  • 2020-12-07 06:28

    It seems really surprising at first, you think while you didn't assign the edited object back to the list, why is the list item edited?

    The key point is here: Classes are Reference Type.

    You passed selected account to the edit form and since it's a class and classes are reference type, in fact you are editing the same instance which is in the list. So when you edit properties, all edits are directly applying to the object regardless of clicking OK or Cancel.

    0 讨论(0)
提交回复
热议问题