List<string> alltypes = new List<string>();
try
{
alltypes = Directory.GetFiles(textBox3.Text, "*.*", SearchOption.AllDirectories).ToList();
}
catch (UnauthorizedAccessException)
{
}
if (alltypes.Count > 0)
{
if (comboBox1.Items.Count > 0)
comboBox1.Items.Clear();
comboBox1.Items.Add("Possible Extensions");
foreach (string ext in alltypes)
{
if (!comboBox1.Items.Contains(Path.GetExtension(ext)))
comboBox1.Items.Add(Path.GetExtension(ext));
}
}
When it gets to the catch it just stops, it never continues getting the files so the List alltypes is empty. For example in this case in textBox3.Text the value is c:\.