Version: .NET Framework 2.0
In my Windows Forms application, how can I open a file in its native
program?. Let’s say a listbox displays a list of file names with full paths;
when a user double clicks on a file name, the file opens in its native
program, a Word document opens in a Word Application, an HTML file opens in
IE etc. etc. Much like search result pane of Windows Explorer Search utility.
Thank you 2 1399
Nam wrote:
Version: .NET Framework 2.0
In my Windows Forms application, how can I open a file in its native
program?. Let’s say a listbox displays a list of file names with full paths;
when a user double clicks on a file name, the file opens in its native
program, a Word document opens in a Word Application, an HTML file opens in
IE etc. etc. Much like search result pane of Windows Explorer Search utility.
Thank you
System.Diagnost ics.Process has method Start, that "Starts a process
resource by specifying the name of a document or application file and
associates the resource with a new Process component.".
Following code works fine:
OpenFileDialog ofd = new OpenFileDialog( );
if (ofd.ShowDialog () == DialogResult.OK )
System.Diagnost ics.Process.Sta rt(ofd.FileName );
The file open dialog shows, and when the user selects a file, and
clicks open, the file is opened on its associated program.
--
Arto Viitanen
Arto,
Thank you very much. You explained it very well and your example was very
easy to understand.
Nam
"Arto Viitanen" wrote:
Nam wrote:
Version: .NET Framework 2.0
In my Windows Forms application, how can I open a file in its native
program?. Let’s say a listbox displays a list of file names with full paths;
when a user double clicks on a file name, the file opens in its native
program, a Word document opens in a Word Application, an HTML file opens in
IE etc. etc. Much like search result pane of Windows Explorer Search utility.
Thank you
System.Diagnost ics.Process has method Start, that "Starts a process
resource by specifying the name of a document or application file and
associates the resource with a new Process component.".
Following code works fine:
OpenFileDialog ofd = new OpenFileDialog( );
if (ofd.ShowDialog () == DialogResult.OK )
System.Diagnost ics.Process.Sta rt(ofd.FileName );
The file open dialog shows, and when the user selects a file, and
clicks open, the file is opened on its associated program.
--
Arto Viitanen This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Prakash Wadhwani |
last post by:
I have an Access Database called "TEMP"
On Opening the "TEMP" Database, I need to use VBA (programmatically):
a) to connect to another database called "PMF"
b) the PMF database requires a password on opening called "allow"
c) to link 5 Tables in the PMF Database ... Table1,2,3,4,5
How do I accomplish the above programmatically using VBA ?
Thx & Best Rgds,
|
by: Alexandra |
last post by:
Hi,
I have a hidden system file that I need to read.
I am logged in as an administrator.
I can not change the file attributes using the windows explorer.
|
by: aldrin |
last post by:
I'm trying to run this code under windows xp sp2 using codeblocks v1.0
compiler with great difficulty.There is no problem with running this
under KDevelop in linux. Any help would be greatly appreciated.
Enter an interesting string.
Too many cooks spoil the broth
Error opening C:\myfile.txt for writing. Program termnated.
This application has requested the Runtime to terminate it in an
unusual way.
|
by: Lee Crabtree |
last post by:
I've got a solution that has a C++ project that compiles to a DLL, and a
C# project that is the main piece of the program.
The DLL is managed C++ on top of regular C++. In one of the native
functions, I make a call that looks a little like this:
file = _fsopen(path, mode, SH_DENYNO);
That call generates a System.NullReferenceException, which makes
ABSOLUTELY no sense, since it's happening in unmanaged code. On top of
|
by: mravichandran |
last post by:
dear Readers,
i will be downloading a zip file from the intranet website
programmatically and i would like to process some of the files inside
them before the user can save it. we have a lot of copies of winzip.
winzip does not let me call their functions as COM or as .NET
assemblies.
I want to use the native compressed folder function present in the
Windows XP OS to open the zip file and process them before the user can
| |
by: Paulson |
last post by:
Dear Freinds
I want to make a program that acts as a reminder for the
users.I need to open up the Scheduled task wizard programmatically.If you
type Tasks in the run command the Tasks folder(ie. Scheduled Taks folder)
is opened,but what I want is to open the Add Scheduled Task wizard in it.Is
there any run command to do that?
Also if I am able to open the Scheduled Task wizard like this is
there any way by which I can...
|
by: =?Utf-8?B?UGV0ZXIgSw==?= |
last post by:
I am working with Visual Studio or alternately with Expression Web. I need
to create about 50 aspx pages with about 1200 thumbnali images, typically
arranged in three to four groups per page, having hyperlinks to the
corresponding full size images.
Can anybody point me to locations in MSDN or elsewhere giving the references
to attach, the commands & objects for creating or opening the pages and
possibly available classes?
I have done...
|
by: =?Utf-8?B?TmFt?= |
last post by:
Version: .NET Framework 2.0
In my Windows Forms application, how can I open a file in its native
program?. Let’s say a listbox displays a list of file names with full paths;
when a user double clicks on a file name, the file opens in its native
program, a Word document opens in a Word Application, an HTML file opens in
IE etc. etc. Much like search result pane of Windows Explorer Search utility.
Thank you
|
by: K Viltersten |
last post by:
I understand that the new versions of MS
Word, MS Excel etc. allow for creation of
a document using XML tags (the technique
or format is called OOXML, i think).
I imagine that the idea behind such
creation resembles principally the way of
creating a GUI using WPF, where one can
mark up what parts of the text mass
should carry this or that format etc.
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |