[Solved] How to edit data from rich text box without deleting the current data in c# [closed]


Assumming at the moment you are simply setting the .Text value equal to you new value, as below:

richTextBox1.Text = "Some More Text";

When you do this you are changing the string value to you new value only. What you need to do is append the string you wish to add to end of the current string. You can do this as follows:

private void button1_Click(object sender, EventArgs e)
{
    richTextBox1.Text += "Some More Text";
}

This will add the text Some More Text to the end of you current value when the button is clicked. If you wanted to append it to the start, or in some other more complex way you should access the existing string using richTextBox1.Text and then concatenate it in the position you want. Such as:

private void button1_Click(object sender, EventArgs e)
{
    richTextBox1.Text = richTextBox1.Text + "Some More Text";
}

The above will append your new string to the start of your Rich Text rather than the end.

4

solved How to edit data from rich text box without deleting the current data in c# [closed]