I would like to suggest you an option. Hope that it will help you
Declare a global TextBoxObject in the page and assign the textbox that is currently focused to this object. there will be an event handler let it be btnW_Click
for all buttons. then you can add text to the focused textbox. See the code for this:
TextBox TextBoxObject; // this will be global
// Event handler for all button
private void btnW_Click(object sender, EventArgs e)
{
if(TextBoxObject!=null)
{
TextBoxObject.Text += btnW.Text; // This will add the character at the end of the current text
// if you want to Add at the current position means use like this
int currentIndex = TextBoxObject.SelectionStart;
TextBoxObject.Text = TextBoxObject.Text.Insert(currentIndex, btnW.Text);
}
}
You have to assign focus to the text box by using following code:
private void textBox2_Click(object sender, EventArgs e)
{
TextBoxObject = textBox1;
}