How do you paste text into a TextBox at the current cursor position in Windows Forms?
Not textbox1 += string
This ensures that the cursor is at some position within the textbox, then inserts the text wherever the cursor is located.
if (textBox1.CaretIndex <= 0)
{
textBox1.Focus();
textBox1.Text = textBox1.Text.Insert(
textBox1.CaretIndex, "Whatever");
}
else
{
textBox1.Text = textBox1.Text.Insert(
textBox1.CaretIndex, "Whatever");
}