开发者

Multiple User Controls referencing the same object

开发者 https://www.devze.com 2022-12-17 18:10 出处:网络
I have created a UserControl in C# that I have put a DataGridView on. When I have only one instance of this UserControl in a WinForms project, it works like intended.

I have created a UserControl in C# that I have put a DataGridView on. When I have only one instance of this UserControl in a WinForms project, it works like intended. When I have two instances of this UserControl in a WinForms project, the second instance of my UserControl behaves the way it should but the first one开发者_运维知识库 does not.

It seems like both UserControl instances reference the same instance of the DataGridView some how.

I would much appreciate any advice in this matter.

Many thanks in advance.


Have you exposed a property on the UserControl that sets/gets the GridView's Datasource? (You can't do this in the UserControl or else you would see the behaviour you are seeing)

0

精彩评论

暂无评论...
验证码 换一张
取 消