Question about PictureBox - Move PictureBox from one form to another form C#

Caroline M

Member
Joined
Jul 13, 2021
Messages
17
Programming Experience
1-3
Hello! So, i need know how i make for i attach one PictureBox and move this image, from a PictureBox1 from Form1 to another PictureBox from a Form2 from the Form3. I gonna use the OpenFileDialog1 and i gonna use this method for attach the images from the Form.
How i make this?
I need the code in C#, please
I gonna show a portion code, in my application:

private void button2_Click(object sender, Events Args e)
{
OpenFileDialog foto = new OpenFileDialog();

if (foto.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = Image = Image.FromFile(foto.Filename);
}
}


-----------------------------------------------------------------------------------------------------
Now i need make this code work and run, using this method, but, attach, in the Form2 and in the Form3, all right?
 
Wait... Is your name Caroline M or is it @Rinaldo Meneses Costa ? Your question and phrasing is exactly the same as this other thread as well as his other thread, down to the "I need the code in C#".

In general, you don't move or copy picture boxes between forms. You copy the data that is being displayed by the picture boxes between the forms.

Please read (or re-read as the case maybe) @jmcilhinney response to one of the other gimme-the-codez threads:

 
Last edited:
At least this question is of better quality than the other, but if you are the same person then you should have simply added the extra information to that thread. If you are a different person then I can only assume that you are part of the same programming class but you, at least, seem to be putting a bit more effort in that your classmate.
 
What you actually want to move between forms isn't really relevant to the principle. Data is data and moving data between forms is basically the same no matter what that data is. You should understand the principle first, then you can apply that to any forms and any data. Just in case you are a different person, I will provide a link here to my blog post that explains and demonstrates the principle:


That is part 3 and contains the most important information, but you probably ought to read at least part 2 as well, which provides a quick and dirty option for contrast. Part 1 might be worth read too, but it uses VB-specific functionality, so might just confuse the issue. You can simulate that functionality in C# but, to be frank, I wouldn't recommend doing so.
 

Latest posts

Back
Top Bottom