Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in Form1

C#
public PictureBox pic
       {
           get
           {
               return pictureBox1;
           }
       }

in Form2,

C#
private void button5_Click(object sender, EventArgs e)
      {
          getpic();
      }


      private void getpic()
      {
          Form1 frm = new Form1();
          frm.pic.Visible = true;
      }


What I have tried:

I have tried with the above code. I am not getting any error but also it doesn't gives the desired output. Also based upon the test result i need to load the image from form2 (if pass - tickmark.jpg,if fail - Xmark.jpg). Please let me know how to achieve the result.
Posted
Updated 17-May-16 15:29pm

1 solution

This is one of the popular questions related to form collaboration. I decided to write a Tips/Trick article complete with detailed code samples and explanations: Many Questions Answered at Once — Collaboration between Windows Forms or WPF Windows.

—SA
 
Share this answer
 
Comments
Member 12226114 17-May-16 23:11pm    
Many thanks to you
Sergey Alexandrovich Kryukov 18-May-16 9:18am    
You are very welcome.
Good luck, call again.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900