473,503 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Splitting filenames into parts

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
Mar 17 '06 #1
4 1028
"Dave Cullen" <no****@mail.com> wrote in message news:44***************@mail.com...
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


io.Path.GetFileName(path)

--

Al Reid
Mar 17 '06 #2

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.

Mar 17 '06 #3
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.

"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.

Mar 17 '06 #4
"Dave Cullen" <no****@mail.com> schrieb:
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?


You may want to take a look at the shared methods of the 'System.IO.Path'
class.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 18 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3264
by: Sandman | last post by:
I am splitting a text block into paragraphs, to be able to add images and stuff like that to a specific paragraph in a content management system. Well, right now I'm splittin on two or more...
11
4330
by: Marian Aldenhövel | last post by:
Hi, I am very new to Python and have run into the following problem. If I do something like dir = os.listdir(somepath) for d in dir: print d The program fails for filenames that contain...
3
5540
by: Patrick Coleman | last post by:
Hi, I'm looking for a function to split urls into their component parts, ie protocol, host, path, filename, extension. I'm really only looking for path and hostname (so I can download a webpage...
6
2258
by: nwheavyw8 | last post by:
I am currently trying to write a simple PHP script that will split an uploading file up into 500kb "chunks", then read and concatenate them back together when accessed for download. I can't seem...
0
915
by: melis | last post by:
Hi all, I am new to MFC, and cannot find a way to the following problem :( What I am trying to do is just to split the window into two parts, tyring to have a CFormView or CDialog on left and a...
2
2204
by: Anat | last post by:
Hi, I need a little help on performing string manipulation: I want to take a given string, and make certain words hyperlinks. For example: "Hello world, this is a wonderful day!" I'd like the...
2
2855
by: Matt | last post by:
Hi, I'm ridiculously new to Access (about a week!) so please be patient! My database is a record of British Standards. Each has a unique identifier. Some are split into parts. I would like...
2
1464
by: CharChabil | last post by:
Using Vb.net 2005, I want to read each part in this string in an array (splitting the string) ----------- A1/EXT "BK82 LB73 21233" 105 061018 1804 ----------- That Code that i used is as follow:...
3
1954
by: jb | last post by:
Am using the 'Web Application Project' model for an asp.net web app. Sections of this now need to be reusable. Is it possible to split into sub projects? What happens with /bin directory if so -...
5
2030
by: mosscliffe | last post by:
I am looking for a simple split function to create a list of entries from a string which contains quoted elements. Like in 'google' search. eg string = 'bob john "johnny cash" 234 june' and...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.