none
new line character

    Question

  • I am developing a Windows form app using Visual C# 2010 express.

    I have text boxes set to multiline and no word wrap.

    I have tried the following code:

    card = deck[s, bt] + "+ "of"+ " "+ deck[s, 0];

      card += "\n";

    I have also tried card += system.Enviroment.NewLine

    the statement textBox1.Text = card will write text to the text box however the new line character is ignored.

    What am I doing wrong?

    I am running Windows 10.


    John Scholl

    Friday, March 09, 2018 2:29 AM

Answers

  • I'm not sure what you expect to see, because you are only writing one line so putting a newline character on the end won't make any difference.

    If you want multiple lines, try using textBox1.AppendText, or set textBox1.Lines.



    • Edited by Ante Meridian Friday, March 09, 2018 2:54 AM typo
    • Marked as answer by johnscholl Friday, March 09, 2018 3:08 AM
    Friday, March 09, 2018 2:47 AM

All replies

  • I'm not sure what you expect to see, because you are only writing one line so putting a newline character on the end won't make any difference.

    If you want multiple lines, try using textBox1.AppendText, or set textBox1.Lines.



    • Edited by Ante Meridian Friday, March 09, 2018 2:54 AM typo
    • Marked as answer by johnscholl Friday, March 09, 2018 3:08 AM
    Friday, March 09, 2018 2:47 AM
  • Sorry for the misunderstanding. What I meat  is that I was trying to use to code to write several lines in the text box by executing it with varying values for card.

    John Scholl

    Friday, March 09, 2018 2:55 AM