-2

I am saving dafault values to a xml file. If I don't have access to the xml file I should show a message in the status bar to the user. How can I do that?

sschrass
  • 6,713
  • 6
  • 42
  • 58
mouna
  • 9
  • 3

2 Answers2

1

Just try to open it, if you don't have access it will throw a System.UnauthorizedAccessException or if it is in use it will throw a System.IO.IOException, catch these exceptions and display an access denied message to the user.

Ben Robinson
  • 21,319
  • 5
  • 61
  • 78
0

Check out this post: Is there a way to check if a file is in use?

Community
  • 1
  • 1
James Santiago
  • 2,713
  • 4
  • 21
  • 28