I added my program to the startup using RegistryKey like this :
private async void baslatKontrol_CheckedChanged(object sender, EventArgs e)
{
RegistryKey rk = Registry.CurrentUser.OpenSubKey
("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
string yol = Path.Combine(Environment.CurrentDirectory, "Asistanim.exe");
if (baslatKontrol.Checked)
{
rk.SetValue(yol, Application.ExecutablePath);
veri.Baslat = true;
await JsonVeriden(veri);
}
else
{
rk.DeleteValue(yol, false);
veri.Baslat = false;
await JsonVeriden(veri);
}
}
The problem is; There is a file called "Veri.json" which is located in my program's directory but every time i restart the computer and my program runs, it gives me the exception of "Veri.json is not found in C:\Windows\system32\Veri.json".
My program is running somewhere else and i want my program to use files that it creates on it's current directory. How can do so?