Solved

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

Posted on 2004-09-05
1
232 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

749 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