I am creating my first Windows Forms project, and I am looking for a little advice. Right now, I have two forms. One gets product information from a user, and the other displays it in a table. I have an inventory class that contains a collection of products. I imagine that the forms should not instantiate this collection, they should merely have access to it. But if this is the case, where do I instantiate my inventory class? And once I do, how do I pass data from this class to my forms? Note that I am not allowed to use data binding.
thank you
You can use singleton pattern here. Read more about it here.
For example
}
And later each your form can access single instance of this class and work with it
Inventory.Instance.someMethod()