Hi All,
I am have textbox and 4 button in my page (A, B, Delete and Enter). If i click the button it has to send key event to the textbox.
Problem: No action is happening on the textbox.
Code:
void buttonElement_Click(object sender, RoutedEventArgs e)
{
// create variable for holding string
String sendString = "";
// stop all event handling
e.Handled = true;
// set sendstring to key
sendString = ((Button)sender).CommandParameter.ToString();
// if something to send
if (!String.IsNullOrEmpty(sendString))
{
// if sending a string
if (sendString.Length > 1)
{
// add {}
sendString = "{" + sendString + "}";
}
// set keyboard focus
System.Windows.Input.Keyboard.Focus(this.txtSearch);
System.Windows.Forms.SendKeys.SendWait(sendString);
}
}
Geetha.