So as the question says I have a program set up to start at windows startup, but it doesn't read the .txt next to it, when I launch the program it does.
bool cdexist = File.Exists("cd.txt");
if (cdexist)
{
StreamReader sr = new StreamReader("cd.txt");
time = Convert.ToInt32(sr.ReadLine());
sr.Close();
if (time != 0)
{}.....rest of the code
Whats could be the issue?
Edit: part where I write to the file
{
timeleft = time - i;
label1.Text = timeleft.ToString();
StreamWriter sw = new StreamWriter("cd.txt");
sw.Write(timeleft);
sw.Close();
i++;
}
EDIT I am unable to solve the issue, I tried recreating what happens when the PC starts, and as soon as I'm at the desktop I start the program and it's working, but when the system does it automatically with windows it doesn't seem to read the .txt.