Monday, October 1, 2018

How to upload image in picturebox by OpenFileDialog in c#

 private void btnUpload_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Filter = "jpeg|*.jpg|bmp|*.bmp|all files|*.*";
            DialogResult res = openFileDialog1.ShowDialog();
            if (res == DialogResult.OK)
            {
                pictureEdit1.Image = Image.FromFile(openFileDialog1.FileName);
            }
        }

No comments:

Post a Comment