473,386 Members | 1,720 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,386 software developers and data experts.

Process.Start(MyResource)

Hi,
I'm having trouble opening a pdf (in a viewer) that I've added as a resource file.
I can open a file ok:
System.Diagnostics.Process.Start("MyPdf.pdf");

However trying to access it as a resource file I'm a bit stuck.

System.Diagnostics.Process.Start(TestApp.Propertie s.Resources.MyPdf);

The above line does not work as Process.Start() expects a string as an argument, whereas the resource is of type byte[]. Is there an alternative to Process.Start() that will open a file with it's default program? Or can I reference the resource file in a different way?

Any help is most appreciated,
Ben
May 4 '09 #1
3 2591
Plater
7,872 Expert 4TB
Well you don't have a file (yet), you have a series of bytes (the byte[])
Try writing it to a temp file first and then opening that temp file?
May 4 '09 #2
Thankyou Plater! That did the trick.
Just one more question - would it be good practice to delete the temp file after the user has finished using it? If the answer is yes, how would you go about doing that? Is it possible to detect an event of that file closing?

Many thanks for your help
May 4 '09 #3
Plater
7,872 Expert 4TB
I would generally say yes, it would be good to delete the file, to avoid bloating the file system with temp files. But I wouldn't be sure how to detect if the file is no longer in use, other then to try to delete it.
May 4 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jesse | last post by:
Hi together, I've a problem with compiling an application with a build-Script and run it after. Several resource-files I compile with resgen.exe and put the files into a folders of the...
4
by: xyu | last post by:
Hello, First I would like to thank anyone who helps me, much appreciated. I'm a c++ programmer just started using c#. I'm writing some big hash table so I want to actively take my object off...
0
by: marcus | last post by:
I am developing a web site at work that needs to be both in French and English. I have been reading up on using resource files (.resx files) in combination with setting the CultureInfo to either...
6
by: ad | last post by:
I wnat to load a file in an .resx file and transfer the file to a stream. How can I do?
10
Airslash
by: Airslash | last post by:
Hello, I'm aware that the code I'm currently using is far from perfect. I'm not even sure if it does exactly what it is supposed to do, but I'm trying to do the following: My Resources class,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.