Solved

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

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

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…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now