I have a main windows form and another form that inherits from it.
The second form needs to access the controls (Buttons, PictureBox, etc.) of the main form.
Because it inherits from the main form, the default appearance of the child form is identical to the default appearance of the main form.
How can I overcome this and access the main form’s controls at the same time?
I don’t want to be forced to change my design again!
Question is solved, Thnx for answers…
Well, simply don’t inherit it. How and why did you inherit it? And what do you want to access?
If on
Form2you have the following code:Then in
DoSomethingWithForm1you can call methods and access controls on the other form. This is however not a clever design, you’d rather work with Data Transfer Objects or a kind of FormRepository that contains all your forms and passes data between them, so your forms won’t have to know about each other.