How To Add Image From Picturebox To Datagridview In C Sharp Windows Application

How To Add Image From Picturebox To Datagridview In C# Windows Application

How To Add Image From Picturebox To Datagridview In C# Windows Application
How To Add Image From Picturebox To Datagridview In C# Windows Application
How To Add Image From Picturebox To Datagridview In C# Windows Application

This Tutorial Shows How To Add Image From Picturebox To Datagridview In C# Windows Application

C# SOURCE CODE

       private void button2_Click(object sender, EventArgs e)
        {
            String firstName = textBoxFirstName.Text;
            String lastName = textBoxLastName.Text;
            String gender = "";
            String country = "";

            if (radioButtonGenderMale.Checked == true)
            {
                gender = "Male";
            }
            else if (radioButtonGenderFemale.Checked == true)
            {
                gender = "Female";
            }

            country = comboBoxCountry.SelectedItem.ToString();

            MemoryStream ms = new MemoryStream();

            pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
            Byte[] img = ms.ToArray();

            dataGridView1.Rows.Add(firstName, lastName, gender, country, imagePath, img);

            //dataGridView1.DataSource = table;
        }
READ MORE  Facebook Features & How To Use Facebook: Tips And Tricks You Should Know

Leave a Reply

Your email address will not be published. Required fields are marked *