Call Function Wtih Key Stroke

I have a function on my WinForm that basically just loads a DataGrid.

I want the user to be able to hit the F5 button to refresh the grid if they want.  IS this possible?
Who is Participating?
Jorge PaulinoConnect With a Mentor IT Pro/DeveloperCommented:
On KeyDown or KeyUp event you can do:

If e.KeyCode = Keys.F5 Then
  ' your code
End If

Don't forget to set the form property KeyPreview = True

chrisryhalAuthor Commented:
Solution was perfect
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.