Solved

WriteLine from string into textbox

Posted on 2013-10-25
2
240 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
2 Comments
 
LVL 15

Expert Comment

by:Ess Kay
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now