Solved

WriteLine from string into textbox

Posted on 2013-10-25
2
249 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

Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

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.   …
Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

690 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