I have a program written in C# using visual studio 2022. I'm trying to use File Stream to display a picture on my form. I keep getting an error message Access to the path 'G:\Train Inventory' is denied.' I've researched the web to no avail. I've set the permissions, sharing, etc., all to no avail. Here is a small snippet of my code
C#:
String FilePath = "G:\\Train Inventory";
// Example: Create a MemoryStream from an existing image file
var imagePath = FilePath;
var fileStream = new FileStream(imagePath, FileMode.Open, FileAccess.Read); \\this line throws the error
var memoryStream = new MemoryStream();
fileStream.CopyTo(memoryStream);
Last edited by a moderator: