Advertisement

08.22.2007 at 01:52PM PDT, ID: 22780696
[x]
Attachment Details

c# convert stream to string file dialog question

Asked by jackjohnson44 in .Net Editors & IDEs, Microsoft Visual C#.Net

Tags: string, convert, stream, file

I am trying to read a text file into a text box, but I can't figure out how to convert a stream to a string.

        private void ReadFileIntoTextBox()
        {
            System.IO.Stream fileContents;

            OpenFileDialog OpenFileDialog = new OpenFileDialog();
            OpenFileDialog.Filter = "txt files (*.txt)|*.txt";

            if (OpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                fileContents = OpenFileDialog.OpenFile();
                txtBody.Text = fileContents;
            }

        }Start Free Trial
[+][-]08.22.2007 at 02:09PM PDT, ID: 19749711

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.22.2007 at 02:20PM PDT, ID: 19749785

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .Net Editors & IDEs, Microsoft Visual C#.Net
Tags: string, convert, stream, file
Sign Up Now!
Solution Provided By: FernandoSoto
Participating Experts: 4
Solution Grade: A
 
 
[+][-]08.22.2007 at 06:40PM PDT, ID: 19750988

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628