I’ve created a user control keyboard… when you click on a button in the keyboard the button_click event is thrown and a string is get a parameter example when clicking on button C
CButton_Click
{
txt="C";
}
I need to catch that event outside the user control… so that when clicking on the button a textbox is filled with the string… giving the impression the texbox is filling up while the user clicks on the buttons…
This is for a touchscreen application.
You have to declare your own event in the UserControl and fire the event when necessary. Using your example:
Then you can subscribe to the UserControl’s
ButtonClickedevent from other code.A better way, however, might be to make your own EventArgs and pass the string in the event itself instead of just storing the last keypress in a field. Something like the following: