?
Solved

WriteLine from string into textbox

Posted on 2013-10-25
2
Medium Priority
?
254 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 2000 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
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…

649 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