Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-09-05
1
Medium Priority
?
243 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
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

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

885 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