Click here to Skip to main content
15,357,293 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more: , +
I have multiple pictures in my form and when I click on each picture another form is opened
let's say I have a picture of a toy, and when I click on the toy a form with information about the toy is opened, now inside that form, I have many buttons, for example, a button to by this toy. I click on buy, then the picture of the toy with the information is moved to another form with lists of toys I want to buy.
I need help, please

What I have tried:

I've searched all over youtube but did not find anything
Updated 4-May-22 22:22pm
Richard Deeming 5-May-22 4:21am
You've forgotten to ask a question. Just dumping a list of requirements and saying "I need help" suggests you want someone to write the code for you - in which case, you've come to the wrong site.

If you actually need help to fix a problem with code you have written, then you need to provide the relevant parts of your code, the full details of any errors, and a clear and precise description of what you have tried and where you are stuck.
ghada alabbasi 5-May-22 4:45am
You can’t just judge on me like that!!
I’ve worked on my project for weeks
I asked for a simple method to pass an image like any other human on this site who needs quick answers
who are you talking to me in this way without any respect. If you don’t want to help then just move on!! God
Richard Deeming 5-May-22 4:54am
If you want someone to write your code for you, there are plenty of sites where you can hire a developer. This is not one of them.

If you actually want someone to help you with a question, then you need to learn how to ask a question. Dumping your list of requirements and demanding help, without showing any effort to do your own work, is not how you do it.

And complaining when you're asked to follow the rules of the site is a great way to get kicked off the site.
ghada alabbasi 5-May-22 13:16pm
Leaving by my self psycho
ghada alabbasi 5-May-22 13:18pm
Also i got the answer I wanted now get lost🤣

1 solution

Basically, don't.
Instead pass the Image that the PictureBox is displaying as a parameter to the Constructor of the new form:
public partial class FrmItemDetail : Form
   public FrmItemDetail(Image pic)
      MyPictureBox.Image = pic;

Then just pass it the relevant picture:
private void ShowItemDetail()
   FrmItemDetail frm = new FrmItemDetail(PicBoxItem.Image);
That way, the internals of the new form are unknown to the "parent" so it can do what it needs to and change when it must without affecting the outside world.

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