shlomi gadol

shlomi gadol

  • NA
  • 36
  • 57.1k

how to send keys to webbrowser

Jun 13 2015 4:15 PM

Hi,

 
I want to use the SendKeys Methode to send keystrokes to a Webbrowser Control. Think about a form with the Webbrowser control and a button.

If you click on the button the key "a" should be send to the webbrowsercontrol. So i have informed myself and found the SendKey Methode. (the current code)

webBrowser1.Focus(); 
SendKeys.Send("a");

 

Now my Problem! This is working but only every second click. So assume you click on the button the first time, then this wont work. When you click again on the button the a appears in the Webbrowser...
 
I also used webBrowser1.select(); and Sendkeys.Sendwait("a");
 
Any suggestions how this could be?
 
Thanks
Shlomi 

Answers (3)