i place two forms one contain 2 picturebox and 2 button and 2nd form contain 2 picturebox and one button
when insert image in 1st form it automaticaly load on 2nd form when 2nd form load.
plzzzzzzzzzzzzzz help me to do this

Recommended Answers

All 3 Replies

when you show the 2nd form pass the path of loaded image in 2nd form and in form2_load event load that image in picturebox

as

//code in form 1
 String strFileName = "";
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Image FIles (*.jpg)|*.jpg|All files (*.*)|*.*";
            //openFileDialog1.InitialDirectory = @"d:/";
            openFileDialog1.Title = "Select an image file"; 
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
                strFileName = openFileDialog1.FileName;
          
            if (strFileName != "")
                pictureBox1.Image = Image.FromFile(strFileName);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form2 obj = new Form2(strFileName);
            obj.Show();
        }

//code in form 2

 String PathOfImage = "";
        public Form2(String Path)
        {
            InitializeComponent();
            PathOfImage = Path;
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            pictureBox1.Image = Image.FromFile(@PathOfImage);
        }
commented: Continous effort. +14
commented: Godd Logic +3

Thankes alot realy thankes thankes alot

You are welcome :) if your problem is solved please mark this thread solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.