.net - C# FileNotFoundException on Application startup -


i have problem app. when run myself works perfect. when app start startup have system.io.filenotfoundexception. add app on startup following code:

registrykey wownode = registry.localmachine.opensubkey("software\\wow6432node\\microsoft\\windows\\currentversion\\run", true);  wownode.setvalue("myapp", system.reflection.assembly.getentryassembly().location); 

and when app start after reboot have system.io.filenotfoundexception files in same directory .exe file

can me this?

code use read file:

names = file.readalllines("name.txt"); 

when started startup, current directory not set .exe resides. use application.executablepath directory in app resides , use suffix "name.txt" it's true path.


Comments

Popular posts from this blog

python 3 IndexError: list index out of range -

android - How to save instance state of selected radiobutton on menu -

IF statement in MySQL trigger -