hi,
You probably have something like:
public partial class VirtualKeyboard : UserControl
{
// ... your code here
}
Add to that:
public partial class VirtualKeyboard : UserControl
{
private TextBox textBoxToUse;
public TextBox TextBox
{
get { return this.textBoxToUse; }
set { this.textBoxToUse = value; }
}
// ... your code here
}
Then,
in your UserControl, when a key is pressed, check to make sure that
this.textBoxToUse != null, and if it's not, work on it.
In your
form, you'd add your user control to your form, then, when you wanted to
change which text box is the "active" one, you could just do:
this.virtualKeyboard.TextBox = textBox1;
At that point, the virtual keyboard would work on textBox1.