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 6547
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: John |
last post by:
I wrote a MDI application with a CRichEditView. When the user clicks on a
button the program displays a dialog box and after the user closes the
dialog box the program has to open a new document and then write a text
string in it. I wrote the following code to do that.
void CFormatPlannerView::OnPlaylistGenerate()
{
CGenerateDlg dlg;
if (dlg.DoModal() == IDOK)
{
|
by: Alfons |
last post by:
Hello,
I have build a program that can do file transferring between a Windows
XP computer and a DOS computer via a serial port. The Windows program
I have build in C++ with Visual Studio 6.0. The DOS program I made in
Turbo C++ 3.0.
At this moment I am in a test phase of sending files and directories.
The code I am using in DOS to open a file for writing looks like this
(forgive me the typos, since I only have my source code at work...
|
by: Madhur |
last post by:
Hello
what about this nice way to open a file in single line rather than using
if and else.
#include<stdio.h>
void main()
{
FILE *nd;
clrscr();
fopen("c:\\autoexec.bat","r")&&printf("success") || printf("error opeing
|
by: Justin Fancy |
last post by:
Hi Everyone,
I am developing a file aging program that will eventually report on
every folder that is in the root directory. I have a list of requested
years, and counters set up to count every file within every subfolder
to add up all the files from the specified year. I have the
functionality working, but not quite. With the following code, the end
result includes folders within subfolders. For example, instead of
having root/folder1/...
|
by: bimeldip |
last post by:
Hi,
I an tryin to create a html page where users can choose a file and open it however, i keep getting it wrong.So far this is wat i've worked on:
(open.html)
<html>
<head>
<title>Opening file</title>
</head>
<body>
<form action="display.php" method="POST">
Please choose a file: <input name="saved" type="file" /><br />
| |
by: shalmi27 |
last post by:
hi every1
me new to this forum....
well i really need help...
i want a c++ file handling program...
for eg: like hotel management,games,railway reservation......
the program..must b able to change or del the particular data...given by the user....
plsss...any1..who can help me..plss d help me...
|
by: =?Utf-8?B?Vmlua2k=?= |
last post by:
Hello Everyone,
I need to open a text file with .net remoting. This text file resides on
another server. My server program running on the server has this method that
opens the text file
System.Diagnostics.Process.Start(filePath);
My client program has a button which I click and it call the server
program method that opens the file. When I click the button, the file opens
on the server itself, is it possible that I can see that file...
|
by: sophia |
last post by:
Dear all,
the following is the file compression program ,using elimination of
spaces, which I saw in a book
#include<stdio.h>
#include<stdlib.h>
int main(int argc,char * argv)
{
|
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: rcook349 |
last post by:
From within my project, I am opening an file elsewhere on the network and
changing contents within.
When I go to close/save, however, I can't because it's read-only (as it's
checked in).
Can I just flip read-only off, make my changes and save it, and then flip
read only back on (programmatically)? How can I do this, please?
Thanks.
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |