Alex Rivera | Logout

Simulating Key Press C#

Asked 2010-06-15T17:05:18.833
62

I want to simulate F5 key press in my C# program. When IE is open, I want to be able refresh my website automatically.

How can I do that?

c#
Edit
Report

2 Answers

5

Another alternative to simulating a F5 key press would be to simply host the WebBrowser control in the Window Forms application. You use the WebBrowser.Navigate method to load your web page and then use a standard Timer and on each tick of the timer you just re-Navigate to the url which will reload the page.

answered 2010-06-15T17:25:21.663
3

Instead of forcing an F5 keypress when you're just trying to get the page to postback, you can call a postback based on a JS event (even mousemove or timer_tick if you want it to fire all the time). Use the code at http://weblogs.asp.net/mnolton/archive/2003/06/04/8260.aspx as a reference.

answered 2010-06-15T18:30:46.693

Your Answer