1
Open Command Prompt, then paste in this command and press Enter:
msdt.exe -id KeyboardDiagnostic
Run that Keyboard Troubleshooter to see if that can solve the problem.
2
If that does not resolve this for you
Open Device Manager
Expand the Keyboards section
Right click your keyboard and choose 'Uninstall'
Then restart your PC
3
If the problem is still not resolved:
Bring up the on-screen keyboard, do you see the number 9 being pressed on that keyboard even though you are not typing that key?
Connect another external keyboard to your system, does the same problem occur with that keyboard?