Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am creating a Windows application in c#. In that i am playing video files to play in media player but at the time of design I am giving URL="D\\Video\\abc.avi".
after making exe of that application i am giving path to run exe on C Drive then it will create error to play video file because in URL path of video file is D drive and save setup on C Drive.
please help me. Sorry My English is weak.
Posted
Updated 28-Jun-13 19:47pm
v2
Comments
Pheonyx 28-Jun-13 7:18am    
a) what is the error
b) on what line of code does this error occur?

Use the improve question to provide more details and a concise code snippet of where the error is occurring.
Killzone DeathMan 28-Jun-13 7:27am    
For a incomplete question, you just send an incomplete answer ;)
Killzone DeathMan 28-Jun-13 7:26am    
string path;

path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase );
moresaurabh007 29-Jun-13 1:38am    
thank you sir

string Path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

it will give you the path of the ApplicationData folder which is common in different OS
 
Share this answer
 
You may use this code:

string path= @"\myvideo.wmv";

path = Application.StartupPath + path;

it will always reach the Debug folder automatically and if you have created the setup, then it will be the path where your application's .exe file is situated at runtime. Remember to place your video in "Drivename:\Project1\bin\Debug\" folder i.e. your video must be in Debug folder.

Hope its helpful.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900