Reputation: 6736
Learning C#:
I have structure of
form1 (splitcontainer)
userformLeft (button + sub-panel)
userformDisplay (loaded into panel in userformLeft)
userformRight
I want to execute a method in userformDisplay from form1 (timer in form1).
And the other way around, let's say I have public property form1.mainTimer, can I call it from userFormDisplay like
myLong = this.parent.parent.mainTimer;
or similar.
Upvotes: 0
Views: 738
Reputation: 48139
Similar problems of communicating between one form and another... whether attaching to "events" of one, or calling / setting values to/from each other. Here are a couple links to questions I've answered to in the past that may help understand the relationships to do so.
Sample 1 with explicit steps to create two forms communicating back/forth to each other
Sample 2 somewhat similar, but attaching to events between forms
Upvotes: 1
Reputation:
yes.. you can do this:
myLong = ((form1)this.parent.parent).mainTimer;
Upvotes: 2