Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to split a File name and a Directory from an OpenFileDialog1.filename

Posted on 2004-09-05
1
Medium Priority
?
237 Views
Last Modified: 2012-08-14
Hi all,
I need some help,
                             i have got an open filed dialog for a user to selkect a WAV file but in order to play this WAV file i need to have 2 varables 1 for the file name and one for the acctuall DIR for exaple:
if i wanted to open a WAV fiel from:
C:\Documents and Settings\Administrator\My Documents\1.wav
i would need to split up this string
dim x as string
x = openfiledialog1.fielname()
i woudl need to split it up into 2 varables 1 for:
dim y, z as string
y = "C:\Documents and Settings\Administrator\My Documents"
z = "1.wav"
and i dont know how i would split this up????

thanks
Matt
0
Comment
Question by:bignig32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
con_iezekiel earned 2000 total points
ID: 11983629
hi

     in your example after you get the x filepath from open field dialog you should use System.IO.Path class. (Import System.IO.Path). Then you can

Filename=system.io.path.GetFileName(x) 'Where x is the path you get
Path=system.io.path.GetDirectoryName(x)

Now Filename is "1.wav"
Now Path is "C:\Documents and Settings\Administrator\My Documents\"

As you see this class offers you classes to manipulate path strings. If you check out the other functions you can find more valiuable tools.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question