Hi, I'm pretty new to using C# and have come across a problem that I thought would be pretty simple, and it probably is but I'm stuck.
I'm trying to get a user to select a file using a file dialog box and once that has been selected to get the details of the file added to a list view (set to the detail mode).
So far I have it showing the dialog box and when the user selects the file the file path is added to the first column of the list view.
OpenFileDialog openSingleFile = new OpenFileDialog();
openSingleFile.Title = "Open a Single File";
openSingleFile.InitialDirectory = "C:";
openSingleFile.Filter = "All Files|*.*";
openSingleFile.ShowDialog();
fileinfoViewer.Items.Add(openSingleFile.FileName);
I thought that "FileName" would add only the name like "Worddocument.doc" but instead it adds "C:\Test Folder\Worddocument.doc"
I've come across the code "System.IO.Path.GetFileName" but can't get it to work. I've also tried getting anything to add in to the next column along such as "GetCreatedDate" but no luck with those either.
Has anyone any suggestions?