473,326 Members | 2,095 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

using music file in soundPlayer function

ss
hi!
i would like to use a file that is located in my project folder.
i don't want to use the full path like c:\project\game\whoss.wav (where
game is the folder for .sln file)
hos can i write a reference to the place where the solution is?

Mar 12 '06 #1
4 2255
Application.Path
.... contains a reference to the execution folder.
Relative paths normally work as well.

Mar 12 '06 #2
ss
the probelm is that the execution folder is 'bin' and i can't save
there the music - it's not a good path to load from
any other idea?

Mar 16 '06 #3
Hell,

Well you could create a sub folder inside the folder where your exe is
running from and call the file as follows

string MusicFileName = "test.mp3";
Application.StartupPath + "music\" + MusicFileName;

Hope this helps.

Regards
Scott Blood
C# Developer

"ss" <be********@gmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
the probelm is that the execution folder is 'bin' and i can't save
there the music - it's not a good path to load from
any other idea?

Mar 16 '06 #4
I may be confused as to your actual requirements.

Do you want your installed application to reference a path in a
completely different location?
Could you use a FolderBrowserDialog to let the user choose their
project path?
Otherwise do as Scott says; create a sub folder that is relative to
your executable.
Eg. string path = Application.StartupPath + @"..\..\";
This would be 2 directories above where your EXE is running from.

SN

Mar 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Con | last post by:
Hi, I'm getting the following error message in the JavaScript console: Error: mus has no properties Source File: file:///G:/temp/cafedub.htm Line: 35 Now, I would like to script to work in...
1
by: Gaffer | last post by:
Is it possible to change the following code so that the music is 'off' when the page is loaded and the user gets the option to turn it on? ---------------------------------------------------...
6
by: David Veeneman | last post by:
How do I configure a .NET 2.0 SoundPlayer object to play a WAV file embedded as a resource? I have tried the example in the MSDN documentation, and I am getting nowhere. Is there a simple...
4
by: moondaddy | last post by:
I need to edit the text in many files so I'm writing a small routine to do this. First I have a method that loops through all the files in a directory and passes the full file path to another...
2
by: FlashForumKB | last post by:
Here is a chance for you to make my developers look bad. I have hired these guys to development my website which, in part, has music demos available to my users. These demos must include the...
9
Atran
by: Atran | last post by:
Hello everybody, can anyone till me: What we can do in System.ComponentModel If you can give me easy example too. Thanks for anyhelp.
11
by: globalrev | last post by:
http://www.pygame.org/docs/ref/mixer.html import pygame #pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=3072) //it complained abiout words= so i guess its only the nbrs...
0
by: =?Utf-8?B?TG9nYW4=?= | last post by:
I have an application that plays short (2-5 seconds) sounds from resources at specific times. About 10% of the time the wav file will start playing fine and at some undetermined point during the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.