It's not difficult.
All you have to do is set up a Private class level TextBox variable to hold the last one you were in, and construct an Leave event handler for the 5 textboxes you want to recieve the information - they all go to the same one:
private TextBox lastCursor = null;
private void tbWithCursor_Leave(object sender, EventArgs e)
{
lastCursor = sender as TextBox;
}
The button click event is then simple:
private void butMoveText_Click(object sender, EventArgs e)
{
if (lastCursor != null)
{
lastCursor.Text = tbForWriting.Text;
}
}
What happens is that when the focus leave a TextBox (i.e. it had the cursor in it, but some other control is becoming the active control) the identity of the TextBox is saved.When you click the button, the last saved value is teh TextBox you want to put your text into.
Simples!