I have a folder which contains all images.I want the names of the images to be displayed in a combobox and when i click on a image the image should be displayed in a picturebox(in C#.net).plzz help me in the code
navimir
0
Newbie Poster
Recommended Answers
Jump to PostString[] paths = {"D:\\Project\\Flower-02-KayEss-1.jpg", "D:\\Project\\My Pictures\\123.png" }; private void Form1_Load(object sender, EventArgs e) { comboBox1.Items.Add("Flower"); comboBox1.Items.Add("Table"); comboBox1.Text = "Select"; } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { pictureBox1.Image = new Bitmap(paths[comboBox1.SelectedIndex]); }
Jump to PostMore detailed version
String[] paths; private void Form1_Load(object sender, EventArgs e) { DirectoryInfo di = new DirectoryInfo(@"D:\Project\Pictures\"); paths = new String[di.GetFiles().Count()]; MessageBox.Show(paths.Length + ""); int i = 0; foreach (FileInfo fi in di.GetFiles()) { comboBox1.Items.Add(fi.Name); } foreach (FileInfo fi in di.GetFiles()) { paths[i] = fi.FullName; i++; } …
All 5 Replies
abelLazm
183
Postaholic
abelLazm
183
Postaholic
navimir
0
Newbie Poster
navimir
0
Newbie Poster
ddanbe
2,724
Professional Procrastinator
Featured Poster
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.