cgkumar
cgkumar

Reputation: 19

How to make the function key F5 to function by clicking a button?

My computer F5 function key is broken. 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.

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

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

Upvotes: 0

Views: 1041

Answers (1)

Growlith1223
Growlith1223

Reputation: 11

You don't really need the Select Case in this, well, case.

My.Computer.Keyboard.SendKeys(CStr(Keys.F5))

would be all you really need. You'd just slap this into your Sub. Lemme know if this fixes your issue!

Upvotes: 1

Related Questions