jimmy naik

jimmy naik

  • NA
  • 21
  • 78.6k

add image to picture box

Oct 18 2009 1:31 PM
//hello friends this my code to add images to checklist box.now when i select an image i want the preview of that image to be shown in the picture box.can somebody show me the code for that?..thank u//

private void button3_Click(object sender, EventArgs e)
        {
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                DirectoryInfo FileDirectory = new DirectoryInfo(folderBrowserDialog1.SelectedPath);
                //FileInfo[] FilesFromDirectory = FileDirectory.GetFiles();
                FileInfo[] FileJpg = FileDirectory.GetFiles("*.jpg");
                FileInfo[] FileGif = FileDirectory.GetFiles("*.gif");
                FileInfo[] FileBmp = FileDirectory.GetFiles("*.bmp");
                FileInfo[] FileTif = FileDirectory.GetFiles("*.tif");
                FileInfo[] FilePng = FileDirectory.GetFiles("*.png");
                foreach (FileInfo File in FileJpg)
                {
                    checkedListBox1.Items.Add(File.Name);
                    
                }
                foreach (FileInfo File in FileGif)
                {
                    checkedListBox1.Items.Add(File.Name);
                }
                foreach (FileInfo File in FileGif)
                {
                    checkedListBox1.Items.Add(File.Name);
                }
                foreach (FileInfo File in FileTif)
                {
                    checkedListBox1.Items.Add(File.Name);
                }
                foreach (FileInfo File in FilePng)
                {
                    checkedListBox1.Items.Add(File.Name);
                }
           
            }


        }

Answers (1)