Click here to Skip to main content
15,878,231 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My Nmae is jimson , I am New In c sharp programming
in my project i have one windows form. In this windows form one web browser is there.

when i press CTRL + F1 key that time in my web browser textbox put a name

eg:

i am in home page of google
my cursor in search box in google that time i press CTRL+ F1 at that time one string is enterd in that textbox
is it possible for in windows application
i press another key with ctrl that time another string is entered in textbox
Posted

1 solution

This is a little difficult to find a "nice" solution for, as the WebBrowser control does not expose KeyDown, or KeyPress events.
It does expose PreviewKeyDown though, and that should work (but you may need to fine tune it a bit)

Handle the event, and call the SendKeys.Send method:
C#
SendKeys.Send("Hello");


Be aware this probably will not work on your system: Because your activation sequence includes the CTRL key, there is a very, very good chance that this will be interpreted as CTRL+h, CTRL+e, CTRL+l...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900