Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can anybody share the code for uploading image using c# desktop application
Posted

Try These C# Code it's working:
private void Button_changeImage_LinkClicked(object sender, ButtonClickedEventArgs e)
        {
            objLog.WriteLog("Came to Edit Image of Student on Admission Form");

            string imagename;
            FileDialog openFileDialog_scanImage = new OpenFileDialog();
            openFileDialog_scanImage.Filter = "Image File (*.jpg;*.bmp;)|*.jpg;*.bmp;";
            try
            {
                if (openFileDialog_scanImage.ShowDialog() == DialogResult.OK)
                {
                    imagename = openFileDialog_scanImage.FileName.ToString();
                    Bitmap newimg = new Bitmap(imagename);

                    image_student.SizeMode = PictureBoxSizeMode.StretchImage;

                    image_student.Image = (Image)newimg;

                }
                openFileDialog_scanImage = null;
            }
            catch (System.ArgumentException ae)
            {
              MessageBox.Show(ae.Message.ToString());

            }


        }
 
Share this answer
 
 
Share this answer
 
v3
Hello Professional

there is several control method and classes like Picture box control and File Reader Write method by that you do this.

may these link will help you for your query......

http://www.c-sharpcorner.com/UploadFile/8ea152/fetch-image-from-database-in-windows-form-application/[^]


Happy to help
 
Share this answer
 

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