Search code examples
c#soundplayer

FIle dialog gives path that doesn't work with soundplayer


When I use the file dialog to get a path it gives me the path but it doesn't work with SoundPlayer. The path it returns has the disk letter capitalised which doesn't work with SoundPlayer.

I don't know how to word what I'm searching so I came here

How do I/Can I make it return a path with the disk letter in lower-case?


Solution

  • Use string harddriveletter = yourPath.Substring(0,1) to get the hard drive letter then simply yourPath = yourPath.Replace(harddriveletter,harddriveletter.ToLower())