Mohamed Moumni

Mohamed Moumni

  • NA
  • 48
  • 8.4k

how get directories read only ? c#

Jul 6 2017 3:56 PM
 i use this code to select a path and get all subdirectories of it 
  1. if (FBD_devis.ShowDialog() == DialogResult.OK)  
  2. {  
  3.     try  
  4.     {  
  5.                 
  6.         DirectoryInfo diri_info = new DirectoryInfo(FBD_devis.SelectedPath);             listBox2.Items.AddRange(diri_info.GetDirectories("*", SearchOption.AllDirectories));  
  7.   
  8.     }  
  9.     catch (UnauthorizedAccessException u)  
  10.     {
       MessageBox.Show("le problème c'est a cause ce Dossiers: " + u.Message + "\n" + u.Source);  
  11.   
  12.     }  
  13. }     
 but when i select the path
 
 
 
it generate this problem 
 
how can I fix this problem please ?

Answers (1)