I have a question about how to setup components in a winforms application so they can interact with each other. But I want to use the visual designer to set this up.
What I have is a component called myDataBase and a component called myDataTable.
Now the component myDataTable has a property of type myDataBase.
So in code I can do
myDataBase db = new myDataBase();
myDataTable dt = new myDataTable();
dt.DataBase = db;
The property DataBase in component myDataTable is public, so I can also use the visual designer to assign the DataBase property.
Now for my problem.
I have many many forms that have one or more components of myDataTable on it.
I only want one instance for myDataBase.
What I do now is I create a component myDataBase dbMain = new myDataBase() on the mainform.
On every form I have to set the property for all myDataTable components to this dbMain.
I have to do this in code because the visual designer cannot see the dbMain component on the mainform.
So the question is, can I create one instance of component myDataBase that is visible to the visual designer on all forms, so I can use the visual designer to set the property of myDataTable components ?
For those that now Delphi, I want something like the DataModule in Delphi.