C# open PDF File Not Found error all the time

  • Thread starter Thread starter Domleg
  • Start date Start date
D

Domleg

Guest
No matter what I do I can't get a PDF to simply open in C#.

I tried so many combinations of Process.Start with defining startinfo no startinfo, many attempts with double quotes, @ symbols etc...why is this so hard. Seems like it should just work.


This works great!!! Hard path.

Process.Start(@"C:\Lely Files\Milking and cooling software set 2018-39\Astronaut A5 v1.5 (b7)\documentation\Milking and cooling software set 2018-39.pdf");

This is wrecking my life, hours trying to get it to work, since my .exe can be anywhere on the PC I want to get current path and navigate to a nested path to a PDF or EXE and simply open them.

public string currentpath = System.IO.Directory.GetCurrentDirectory();
//public string currentpath = System.IO.Path.GetDirectoryName(Application.ExecutablePath).ToString(); Tried this, no luck.
string fullpath;
string fullfile;

private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Current Path " + currentpath);
string filename = @"Milking and cooling software set 2018-39.pdf";
fullpath = currentpath + @"\Astronaut A5 v1.5(b7)\documentation\";
MessageBox.Show("fullpath " + fullpath);
fullfile = fullpath + @filename;
MessageBox.Show("fullfile " + fullfile); CORRECT PATH to PDF File!! YES IT EXISTS THERE!!
Process.Start(fullfile); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!Keeps failing here even though the messagebox shows CORRECT PATH!

//Process.Start(@"C:\Lely Files\Milking and cooling software set 2018-39\Astronaut A5 v1.5 (b7)\documentation\Milking and cooling software set 2018-39.pdf");
}


Please help! Can't be that hard to Get current path where my EXE is launched, then combine current path with path to PDF and open the PDF!!!!

Continue reading...
 
Back
Top