![]() |
| ||
| File details in to List View using a file dialog box 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(); 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? |
| ||
| Re: File details in to List View using a file dialog box Define doesnt work, what was your code, how did you use it - it works for me |
| ||
| Re: File details in to List View using a file dialog box Here's and example of a few of the ways I've tried it. None of them have worked, but I could well not be using it in the right way though. Here are a few of the ways I tried
I'm sure that I'm not calling it in the correct manner if none of these work. I did think that it would be possible to get file info straight from the dialog box and put it in to the list view. |
| ||
| Re: File details in to List View using a file dialog box Well the first doesnt use the getfilename from system.io.path so no that wouldnt work the second, would work more, but again and it doesnt ask for the filename, from the class so you probably got somethng like (Object) |
| ||
| Re: File details in to List View using a file dialog box this Quote:
String fileNameOnly; |
| ||
| Re: File details in to List View using a file dialog box hi this looks bit more clear http://www.kanbal.com/index.php?/C/f...-box-in-c.html Regards Kannan Chandrasekaran |
| ||
| Re: File details in to List View using a file dialog box If i'm not wrong (IF), fileopendialog will have a properties call SafeFileName or something like that. It would return the file name. To get extra information. System.IO.FileInfo Fs = new System.IO.FileInfo(thisfile); Then from here get the information from that object. |
| All times are GMT -4. The time now is 2:35 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC