Multiple User Controls referencing the same object
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)
精彩评论