1
Answer

how get directories read only ? c#

Mohamed Moumni

Mohamed Moumni

7y
217
1
 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)