View Single Post
  #3 (permalink)  
Old 06-18-2008, 03:02 PM
Johnnyboy's Avatar   
Johnnyboy Johnnyboy is offline
Learning Programmer
 
Join Date: Nov 2005
Location: NC
Posts: 55
Last Blog:
How to restrict a Text...
Credits: 0
Rep Power: 12
Johnnyboy is on a distinguished road
Default Re: Visual Studio 2008: C# Reading Files

Awesome Jordan. I've only used vb6 and .net until now. Within minutes I was able to convert this to a windows forms application instead of console and am quickly on my way in C#.

THANKS!

If anyone else was wondering, here is what Jordan did using a windows forms app and bringing up the results of a file in a messagebox.

Code:
        private void btnEngrave_Click(object sender, EventArgs e)
        {
            //assign the filename
            string fileName = "c:\\engraving.txt"; 
            
            //create reader and open the file
            TextReader textReader = new StreamReader(fileName);

            // Read text to end of file
            MessageBox.Show(textReader.ReadToEnd());

            textReader.Close();
        }
__________________
When things work the way they should it's a wonderful thing! It's the should part that gets me. visit me @ www.unseenbattle.net and drop me a line.

Last edited by Jordan; 06-18-2008 at 03:40 PM. Reason: Added code tags
Reply With Quote