One cure, which sounds drastic but isn't, is to uninstall the keyboard drivers and then re-boot. Windows will re-install the drivers automatically.
To do this in 8.1, hold down the Windows key and press 'x' (Win key+X) this brings up a menu in which you will see Control panel. Click on Control panel then choose 'System'. In the top left you will see Device manager. Click on this and a screen will open listing your hardware. Expand the entries until you find the one for the keyboard - click on the '+' at the side to do this.
When you have found the entry for 'Keyboard', double click on it and the properties panel will open. Select drivers at the top and then 'Uninstall'. Accept any warnings and uninstall them. Then re-boot. This should solve your problem since, having changed keyboards, it is most likely a driver problem.