textBox1.Text = "4 Nuggets"; If i wanted to press that again it wont put it as a list instead it will replace it. How do i fix this?
Asked
Active
Viewed 183 times
0
-
Make it textBox1.Text += "something" – Berkay Yaylacı Mar 28 '22 at 10:10
-
`textBox1.Text += "4 Nuggets";` – Fildor Mar 28 '22 at 10:10
-
Or [TextBox.AppendText](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.textboxbase.appendtext?view=windowsdesktop-6.0) - see https://stackoverflow.com/questions/20632372/textbox-text-string-vs-textbox-appendtextstring – Caius Jard Mar 28 '22 at 10:12
-
there is no list in your code, just a single textbox. – MakePeaceGreatAgain Mar 28 '22 at 10:18
1 Answers
1
If you want to write like a list first you should make your textbox multiline. You may make it from the designer or with code at runtime. Just wrote make textbox multiline to the internet if you did not.
So if you have a textBox like this
=>4 Nuggets
and you want to add another line like
=>4 Nugget
=>2 Chicken
as like in the comments you should use +=, but to pass the next line you should use '\n'
So your code must be something like this.
string newLine = //something;
textBox1.Text += "'\n'" + newLine;
Or
string newLine = //something;
textBox1.Text = textBox1.Text + "'\n'" +
newLine;
If you need further assistance just wrote

Menderes Ersöz
- 17
- 6