473,387 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How do I launch a pdf file in csharp?

Hi

I am writing a simple winforms application that allows me to select a pdf
file on disk,
and have it launch Adobe Acrobat.

In the Win32 c++ world I would just do a ShellExecute.

How can I accomplish this in csharp?

Or do I have to write some managed c++ module to do this?
Nov 15 '05 #1
3 7786
Tim,

You will want to call the static Start method on the Process class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Tim Osborne" <Ti*********@xcellenet.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi

I am writing a simple winforms application that allows me to select a pdf
file on disk,
and have it launch Adobe Acrobat.

In the Win32 c++ world I would just do a ShellExecute.

How can I accomplish this in csharp?

Or do I have to write some managed c++ module to do this?

Nov 15 '05 #2
Tim,

You will want to call the static Start method on the Process class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Tim Osborne" <Ti*********@xcellenet.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi

I am writing a simple winforms application that allows me to select a pdf
file on disk,
and have it launch Adobe Acrobat.

In the Win32 c++ world I would just do a ShellExecute.

How can I accomplish this in csharp?

Or do I have to write some managed c++ module to do this?

Nov 15 '05 #3
Hi Tim!

this is how I stop the SQL Server:

Process stopServer = new Process();

stopServer.StartInfo.FileName = "net";

stopServer.StartInfo.Arguments = "stop MSSQL$" + this.ServerInfo[2];

stopServer.StartInfo.CreateNoWindow = false;

stopServer.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

stopServer.Start();

stopServer.WaitForExit();

Explanation:

1. First you create a Process 2. You give a starting argument to the
process - that is the program you are starting. In your case that would be
acrobat.exe or something like that 3. Then you give arguments to the
program you are running. You have acrobat.exe as the program and you define
"test.pdf" as the argument 4. The next two lines just mean that you want a
hidden window. 5. Then you start the process and wait for it to exit before
you continue with your program (optional).

Hope this helps,

saso

"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:#s**************@tk2msftngp13.phx.gbl...
Tim,

You will want to call the static Start method on the Process class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Tim Osborne" <Ti*********@xcellenet.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi

I am writing a simple winforms application that allows me to select a pdf file on disk,
and have it launch Adobe Acrobat.

In the Win32 c++ world I would just do a ShellExecute.

How can I accomplish this in csharp?

Or do I have to write some managed c++ module to do this?


Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Caroline | last post by:
I'd like to launch an executable file from a web page. Basically, the user enters seven parameters and then clicks a button to generate a graph. The input is written to a file and then read by...
0
by: Matt Fox | last post by:
All, After installing sp2 I have this issue where if I try to launch an .MDB (Access database) file off any network share through explorer, that is open by multiple users, it will not launch...
0
by: Tim Osborne | last post by:
Hi I am writing a simple winforms application that allows me to select a pdf file on disk, and have it launch Adobe Acrobat. In the Win32 c++ world I would just do a ShellExecute. How can...
1
by: Jo | last post by:
I am having a real problem with the Launch conditions in VS .NET and can only come to the conclusion that it is a bug. It states quite emphatically in the MSDN that Launch Conditions WILL be...
13
by: Ole Hanson | last post by:
Hi I am in need of a way to launch my WinForms-app (app.exe) just by pressing a keyboard combination like (Ctrl-Alt-P). This functionality should be present "out of the box" after the app...
5
by: GrantS | last post by:
Hi I am trying to use ShellExecute to launch an application to display a certain file. The variation on the theme is that I need to be able to specify the application to launch and not simply...
7
by: Christopher C | last post by:
I am using a C# winform to launch some apps for our students. Basically the user hits a button the form hides and the app is launched. When the app exits, the form is unhidden. I have a question on...
4
by: Joe | last post by:
I created a CustomAction for this but I don't think I have it in the right place. I tried both Install and Commit but neither allow it to get to the final screen. Are there any examples of this...
6
by: tempnode | last post by:
I have a problem that I can't seem to solve: I need to write a C++ app that will run off of a floppy. Basically, I will boot into DOS (from a floppy), and run my executable from the floppy. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.