Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#

hey guy am trying to get an image which is on a picturebox
to get it on another form picturebox.
 
i got a picturebox on form1 which is pictureBox1
and i got form2 with pictureBox3 and i want the image which is on pictureBox1 to show on PictureBox3 on form2
 
i have tried this code
pictureBox3.Image.Clone = new Form1.picturebox1.image();
Posted 3-Dec-12 4:14am
sean871503
Comments
Mendor81 at 3-Dec-12 10:46am
   
where does the image come from? if it's from a file then just reload it on the other form.
you could also save it to a temporary image file and reload it this way

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Create a property on Form2 which sets the Image on it's PictureBox:
public Image Image
   {
   get { return myPictrueBox.Image; }
   set { myPictureBox.Image = value; }
   }
Then set it via the instance of Form2 that you create in Form1:
Form2 f = new Form2();
f.Image = myForm1PictureBox.Image;
f.ShowDialog();
  Permalink  
Comments
Mendor81 at 3-Dec-12 10:49am
   
I would have suggested that one next, should type faster next time ;P

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 547
1 ChauhanAjay 180
2 CHill60 135
3 Maciej Los 125
4 Richard Deeming 125
0 Sergey Alexandrovich Kryukov 9,735
1 OriginalGriff 6,987
2 CPallini 5,835
3 George Jonsson 4,017
4 Gihan Liyanage 3,266


Advertise | Privacy | Mobile
Web01 | 2.8.140926.1 | Last Updated 3 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100