ComboBox2 lists all files when folder from comboBox1 is selected.
private void Marriage_Load(object sender, EventArgs e)
{
DirectoryInfo di = new DirectoryInfo(@"\\Phhistmsimgid02\CAMR");
paths = new String[di.GetDirectories().Count()];
// MessageBox.Show(paths.Length + "");
int i = 0;
foreach (DirectoryInfo fi in di.GetDirectories())
{
comboBox1.Items.Add(fi.Name);
}
foreach (DirectoryInfo fi in di.GetDirectories())
{
paths[i] = fi.FullName;
i++;
comboBox2.Sorted = true;
}
comboBox1.SelectedIndex = 0;
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
DirectoryInfo dinf = new DirectoryInfo(@"\\Phhistmsimgid02\CAMR\M07201400802");
paths = new String[dinf.GetFiles().Count()];
int i = 0;
comboBox2.Items.Clear();
pictureBox2.Image = Image.FromFile(@"\\Phhistmsimgid02\CAMR\M07201400802\SCN0001.tif");
foreach (FileInfo finf in dinf.GetFiles())
{
comboBox2.Items.Add(finf.Name);
var count = comboBox2.Items.Count;
//MessageBox.Show("Count is:" + count);
}
foreach (FileInfo finf in dinf.GetFiles())
{
paths[i] = finf.FullName;
i++;
}
} // this part works fine if I mention each folder manually.
Any suggestions and help appreciated.