Click here to Skip to main content
15,890,609 members
Please Sign up or sign in to vote.
1.60/5 (3 votes)
See more:
Hi Friends,

Here I have some problem. My computer F5 function key is spoil. Here I need to refresh data every day. Thus I plan to design a windows form with one button. If I click that button, it would need to perform as F5 key. Could any one help me?

The below code is shows were I design. But it is not work.

VB
Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Button1.Click
        Select Case Keys.F5
        End Select
    End Sub
End Class


Thanks.

Regards, Thanes
Posted
Comments
Sergey Alexandrovich Kryukov 10-Sep-15 22:55pm    
It all makes no sense. What does it mean, "F5 spoil"? If you need to handle F5, add KeyDown or PreviewKeyDown handler; if you need some action on button's click, handle its Click event...
Learn events and delegates; you won't be able to do any programming without learning it all...
—SA
CgKumar 10-Sep-15 23:12pm    
F5 spoil means it cannot function. So I need program it in vb.net for operate the key F5 by clicking mouse on button were I design. Here the other program were I try, but it not function also.

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Select Case e.KeyCode
Case Keys.f5
Button1.PerformClick()
End Select
End Sub
End Class

1 solution

look up SendKeys and see if there is a way you can make it work with your button to activate your F5 key. You may need to play around with getting the program you want it applied to in Focus before it will work...
 
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