'Creating a KeyEventArgs field with the desired KeyCode value in C#

I wanna make an opportunity to rebind some buttons. I have "launchParametrs.txt" file so the KeyEventArgs field must get KeyCode from "Start: (bind button from file)". But I can't write startBind.KeyCode = Keys.F5. The problem is KeyCode is the read-only propertie.

"launchParametrs.txt" - is a file that stores Launch Parametrs. It can store for example this text

Times: 100
Start: F5
Stop: F6

startBind is the KeyEventArgs field. If that file stores a line "Start: F5" then startBind.KeyCode must become equals Keys.F5

So how can I create a field with the desired KeyCode value?

Alternative solution is transformate the string "F5" to KeyCode.F5. Is it possible?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source