C#-APP: How I can control other forms in one form?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yang from china
    New Member
    • Feb 2008
    • 5

    C#-APP: How I can control other forms in one form?

    Exactly I create a main form and a sub form.There are several pictures on the main form.

    what I want to do is when I select one picture in the main form,I want the sub form display that picture immediately and the control is not changed from the main to the sub.

    very thanks!

    Platform:
    FrameWork3.5
    Microsoft Visual C# 2008
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by yang from china
    Exactly I create a main form and a sub form.There are several pictures on the main form.

    what I want to do is when I select one picture in the main form,I want the sub form display that picture immediately and the control is not changed from the main to the sub.

    very thanks!

    Platform:
    FrameWork3.5
    Microsoft Visual C# 2008
    You need a handle(referenc e) of the sub form in the main form. Then in an event handler of the main form you can use that reference to change the properties of the sub form. In this approach, the sub form will ideally have been created from the main form.
    The other approach is to have a Controller class that handles the creation and maintanace of all forms and is capable of passing data between all the forms. (All the forms will have a reference to this controller through their constructors )

    Comment

    • yang from china
      New Member
      • Feb 2008
      • 5

      #3
      very thanks!

      I have done what you had told me to do.

      A new problem troubles me,that is when I chaned the property of form_1 in the form_ 2.then I write:
      form1.validate( );
      form1.Show();
      what I want to know is to concern whether the form1 immediately be changed.
      but I failed.can you show me other ways to see the form1 immediately?

      thanks!

      Comment

      Working...