Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

751 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