|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Splitting filenames into partsThe OpenFileDialog returns a full pathspec and file name in its Filename
property. I want to display only the file and extension without the path. Is there a .NET function to extract that part of the string? Thanks "Dave Cullen" <nospam@mail.com> wrote in message news:441AE48F.31F6CF2B@mail.com... io.Path.GetFileName(path)> The OpenFileDialog returns a full pathspec and file name in its Filename > property. I want to display only the file and extension without the > path. Is there a .NET function to extract that part of the string? > > Thanks -- Al Reid Dave Cullen wrote:
> The OpenFileDialog returns a full pathspec and file name in its Filename If you need to get anything other than filename, check out the FileInfo> property. I want to display only the file and extension without the > path. Is there a .NET function to extract that part of the string? > > Thanks Class. Suppose the filefullpath returned by the OpenFileDialog is stored in
strMyFile, then you can use FileInfo class to get all sort of information you want. Dim fInfo = New FileInfo(strMyFile) Dim fName As String = fInfo.Name Dim fExt As String = fInfo.Extension Dim size As Long = fInfo.Length bla... bla... bla.... Hope this answers your question. VHD50. Show quoteHide quote "za***@construction-imaging.com" wrote: > > Dave Cullen wrote: > > The OpenFileDialog returns a full pathspec and file name in its Filename > > property. I want to display only the file and extension without the > > path. Is there a .NET function to extract that part of the string? > > > > Thanks > > If you need to get anything other than filename, check out the FileInfo > Class. > > "Dave Cullen" <nospam@mail.com> schrieb: You may want to take a look at the shared methods of the 'System.IO.Path' > The OpenFileDialog returns a full pathspec and file name in its Filename > property. I want to display only the file and extension without the > path. Is there a .NET function to extract that part of the string? class. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> |
|||||||||||||||||||||||