a_anis3000
asked on
How to add new line in a textBox
Hello Experts,
I am a complete beginner in C#. I am using the following "for loop" example to enter numbers in a textBox. The example works fine except it displays the end of the loop in the box.
I need to have each digit displayed on a separate line.
Here is the code which is placed inside a button. The textBox1 property is set to multiline.
private void button1_Click(object sender, EventArgs e)
{
for (int intCounter = 1; intCounter <= 100; intCounter++)
{
textBox1.Text = intCounter.ToString() + Environment.NewLine;
}
I am a complete beginner in C#. I am using the following "for loop" example to enter numbers in a textBox. The example works fine except it displays the end of the loop in the box.
I need to have each digit displayed on a separate line.
Here is the code which is placed inside a button. The textBox1 property is set to multiline.
private void button1_Click(object sender, EventArgs e)
{
for (int intCounter = 1; intCounter <= 100; intCounter++)
{
textBox1.Text = intCounter.ToString() + Environment.NewLine;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER