How to pass data from two or more forms ?
-
Hi there I have two forms called form1 and form2 . In form2 I have 10 trackbar . I want to change values in form1 when I change form2 trackbars . How can i do this ? can i select a void in form1 for form2 trackbars ?
-
Hi there I have two forms called form1 and form2 . In form2 I have 10 trackbar . I want to change values in form1 when I change form2 trackbars . How can i do this ? can i select a void in form1 for form2 trackbars ?
Assuming Form1 creates and displays the Form2 instance, the simplest option would be for Form2 to raise a custom event when the values change. Form1 would subscribe to that event, and update its own values accordingly. Alternatively, Form2 would need a reference to the instance of Form1, and would call a public method on the form to update the values. You'll probably want to use an interface for the reference so that the implementation isn't tied to a single concrete class. Or you could use the Mediator pattern. Form2 would publish a message when its values changed. Form1 would subscribe to that message and update its values accordingly. Transferring information between two forms, Part 1: Parent to Child[^] Transferring information between two forms, Part 2: Child to Parent[^] Transferring information between two forms, Part 3: Child to Child[^] Mediator Design Pattern[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Hi there I have two forms called form1 and form2 . In form2 I have 10 trackbar . I want to change values in form1 when I change form2 trackbars . How can i do this ? can i select a void in form1 for form2 trackbars ?
Can you please send your code? It would be useful to help you. :) Thanks.