@Andriesvc , Welcome to Microsoft Q&A, you could try to convert your textbox's text to a string array.
Then you could use string. Replace method to remove the line.
Here is a code example you could refer to.
private void button1_Click(object sender, EventArgs e)
{
string[] arr = textBox1.Text.Split('\r');
foreach (var item in arr)
{
if(item.Contains("baby"))
{
textBox1.Text = textBox1.Text.Replace(item, "");
}
}
}
Result:
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.