954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to show a .txt file on screen +c#

hi frds,
i have create a .txt file and write some data.
i want to open on screen that .txt file for reading by a click a button.
if you have the answer, so please help me.
thanks in advance
....

jainendra.shah
Light Poster
44 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

You can create your viewer to text files by using control like RichTextBox and use .LoadFile method which takes text file path
Or
Using default text file editor on client machine by call Process.Start(filePath);

Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
 

thank you sir, for giving idea. I use richtext box method but when i load the .txt file it hold all data but not show.
will you help me again by providing code.
thanks a lot

jainendra.shah
Light Poster
44 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

No, no code. You havent demonstrated what you've tried, why should someone else do it for you?

You show us your code, you tell us where your debugging says it goes wrong, and we'll help you try and work out why

LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
 

thank you sir
problem is solved by process method

jainendra.shah
Light Poster
44 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

Please mark it as solved then :)

Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
 

System.Diagnostics.Process.Start(@"c:\textfile.txt");
or any other file by just passing the file path along with its extension but not work if the required package is not installed that is needed to open it.

Amit Dhemar
Newbie Poster
1 post since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You