c# - Excel file path doesn't work -


i have (and works):

if (sport == "athletics")             {                 excel_init("c:/users/dries canfyn/desktop/score/scoretablemenathletics.xlsx");             } 

but want include excel file in project.

the excel file in folder called io, in same folder class 'if' in. how can reach excel file? path should use?

determine workingdirectory , use relative path there.
workingdirectory .exe resides, depends on how started process. can use relative path like

if (sport == "athletics")      {          excel_init("io/scoretablemenathletics.xlsx");      } 

i don't know happens inside excel_init, consider msdn, processstartinfo.workingdirectory property:

when useshellexecute property false, gets or sets working directory process started. when useshellexecute true, gets or sets directory contains process started.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -