This functionality can be achieved by using a text box or a rich text box instead of a label
richTextBox1.SelectionStart = richTextBox1.Text.Length;
If your are using a Text box then you can achieve the same by below code.
textBox1.AppendText( "Hello World \r\n");
In the above code \r\n is used to print the “Hello World “text in new line each time it is added to the textbox control.
If your are using a Rich Text box then you can archive the same by below code.
richTextBox1.Text = richTextBox1.Text + "Hellow World \r\n";
richTextBox1.HideSelection = false;
richTextBox1.Focus();richTextBox1.SelectionStart = richTextBox1.Text.Length;
richTextBox1.ScrollToCaret();
In the above code \r\n is used to print the “Hello World “text in new line each time it is added to the rich textbox control.
No comments:
Post a Comment