Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

C# New line on list

Hello, I am trying to load a list in my listbox with my program. I currently have the output showing in the listbox. However, it outputs on a single line rather than a list. Does anyone have any solutions to separate the data entry into different lines?


private void btnSavelist_Click(object sender, EventArgs e)

    {

      using (StreamWriter re = new StreamWriter(@"C:\location\list.txt"))

      {

        re.WriteLine(txtlistgoeshere.Text);

      }


      MessageBox.Show("Your collection has been saved!");



    }


    private void btnLoadlist_Click(object sender, EventArgs e)

    {

      using(StreamReader list = new StreamReader(@"C:\location\list.txt"))

      {

        while (!list.EndOfStream)

        {

          txtlistgoeshere.AppendText(list.ReadLine());

           

        }

Sign In or Register to comment.