开发者

Relative path names VB2010

开发者 https://www.devze.com 2023-02-27 09:49 出处:网络
I\'m trying to write a little Jukebox application in VB Forms, and I need the pathnames of the sound files (\\bin\\Tracks\\\"Insert Name Here\") to be r开发者_运维百科elative instead of absolute, so t

I'm trying to write a little Jukebox application in VB Forms, and I need the pathnames of the sound files (\bin\Tracks\"Insert Name Here") to be r开发者_运维百科elative instead of absolute, so that it may work on a different computer to mine. At the moment, I am testing with the simple Soundplayer class, and the single line of code to play a song is this:

My.Computer.Audio.Play("\bin\Tracks\" & txtCurrentlyPlaying.Text)

It works when, instead of \bin\Tracks\, I put the full pathname (C:\Documents And Settings etc.), but not when I try a relative path such as this. Can anybody help? Thank you for your time. Nick


Try Path.Combine(Environment.CurrentDirectory, txtCurrentlyPlaying.Text)

0

精彩评论

暂无评论...
验证码 换一张
取 消