How to call *.pdf file from main menu?

  • Thread starter Thread starter Chrysan
  • Start date Start date
C

Chrysan

i have created an menu option to call a help file written
in *.pdf format. how do i open this pdf file from Visual
Basic .Net?

thanks.
 
Hi,

You can do something like the following:

System.Diagnostics.ProcessStartInfo pInfo;
Process proc;

proc = new Process();
pInfo = new System.Diagnostics.ProcessStartInfo
("C:\\Program Files\\Adobe\\Acrobat 5.0
\\Reader\\AcroRd32.exe");

// Replace the above string with the path on your system.

string s = "Insert the path to the pdf file here";
pInfo.Arguments = s;
proc.StartInfo = pInfo;
s = null;
proc.Start();
proc.WaitForExit();
proc.Close();

Regards
Harsh Thakur
 
It's work. Thanks!
-----Original Message-----
Hi,

You can do something like the following:

System.Diagnostics.ProcessStartInfo pInfo;
Process proc;

proc = new Process();
pInfo = new System.Diagnostics.ProcessStartInfo
("C:\\Program Files\\Adobe\\Acrobat 5.0
\\Reader\\AcroRd32.exe");

// Replace the above string with the path on your system.

string s = "Insert the path to the pdf file here";
pInfo.Arguments = s;
proc.StartInfo = pInfo;
s = null;
proc.Start();
proc.WaitForExit();
proc.Close();

Regards
Harsh Thakur

.
 
Hi,

While your code works fine, I see that you are expecting the Adobe Acrobat
to be installed in a specific folder. In general I don't think that this is
a good practice, instead I would suggest to use something like this:

System.Diagnostics.Process.Start("YourFile.pdf");

Regards,

Gabriele
 
Back
Top