?
Solved

How-To display a text file when user hits a button

Posted on 2007-10-16
5
Medium Priority
?
173 Views
Last Modified: 2013-12-17
C#.Net VS 2005 - how-to display a text file to users when they click on a button.  I want to learn how to have a text file pop up after a user performs an action.  I have the text file in the project.

0
Comment
Question by:alexmac05
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:JimBrandley
ID: 20087209
A couple of questions:
1. Is this a Windows App or a Web App?
2. Do you want to use the viewer associated with that file type, or load it into a new form/page in your application?

Jim
0
 

Author Comment

by:alexmac05
ID: 20087392
This is a windows app.

I would like to use notepad to open it.

0
 
LVL 22

Accepted Solution

by:
JimBrandley earned 1000 total points
ID: 20087627
That one's easy:
Process.Start("Notepad.exe", "C:\\myPath\\myFile.txt");

Jim
0
 

Author Comment

by:alexmac05
ID: 20092829
 System.Diagnostics.Process.Start("Notepad.exe", "C:\\MyDir\\myFile.txt");
0
 
LVL 22

Expert Comment

by:JimBrandley
ID: 20092946
You can just add:
using System.Diagnostics;

to the top of your source file.

Jim
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month15 days, 22 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question