Solved

WriteLine from string into textbox

Posted on 2013-10-25
2
248 Views
Last Modified: 2013-11-04
I am working with the .cs page behind my default.aspx I have a text box with which I am trying to post the contents of a string. In this case I used System.IO.File.ReadAllLines to read in the lines from a job log file and am trying to display that into my textbox.. Here is the code I am using.

 protected void TextBox1_TextChanged(object sender, EventArgs e)
        {

        }

       

        class ReadFromFile
        {
            static void Main()
            {
                string[] lines = System.IO.File.ReadAllLines(@"c:\scripts\JobLog.txt");
                foreach (string line in lines)
                {
                    Here is where I was thinking I can write output into the text box.
                }
            }
        }
0
Comment
Question by:AjarnJonesy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Expert Comment

by:Ess Kay
ID: 39601114
i sugest a rich text box,

but either way textbox1.text = textbox1.text + " " + line
0
 
LVL 21

Accepted Solution

by:
Randy Poole earned 500 total points
ID: 39601195
static void Main()
{
   string[] lines = System.IO.File.ReadAllLines(@"c:\scripts\JobLog.txt");
    yourtextbox.text="";        
    foreach (string line in lines)
    {
       yourtextbox.text+=line;
    }
}
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

733 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