[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

WriteLine from string into textbox

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
AjarnJonesy
Asked:
AjarnJonesy
1 Solution
 
Ess KayEntrapenuerCommented:
i sugest a rich text box,

but either way textbox1.text = textbox1.text + " " + line
0
 
Randy PooleCommented:
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now