Search code examples
c#.netdirectory-structureopenfiledialog

C# OpenFileDialog Lock To Directory


I am making a software that needs to ONLY be able allow people to select files and folders using the OpenFileDialog that are in the same directory as the program and that are in deeper folders. I don't want the OpenFileDialog to be able to select stuff outside of the program's current directory. Is this possible to do in C# using the OpenFileDialog?

Please let me know

Thanks


Solution

  • you can check if the path is correct after selected

    if its just accept or send message box tell him you select different directory