20

Every now and then my keyboard in Visual Studio starts to behave wrongly. For example Shift + 3 inserts a pound symbol instead of a hash #. Shift + \ inserts a tilde ~ instead of a pipe |. When this happens it only affects the current instance of VS - even if I have multiple VS windows open. Only VS is affected - Notepad and other windows apps are fine. Closing and then reopening the solution I was working on in a new VS 2008 instance resolves the problem.

Does anyone have any idea what key combination I have accidentally pressed to cause this? And how to revert it?

Charles Anderson
  • 19,321
  • 13
  • 57
  • 73
evan w
  • 552
  • 7
  • 15

1 Answers1

31

I had a similar problem (on Windows XP), where my keyboard settings would change without me knowing. @ would swap with “, # with /, etc. It turned out that there’s a built-in Windows keyboard shortcut to swap between keyboard layouts, and it’s ALT + Shift! I must have been accidentally pressing these together every so often.

I fixed the problem by going into the Control Panel, selecting 'Regional and Language Options', then moving to the Language tab and clicking the Details button. This shows you a list of all the alternative keyboard layouts that you have available. I just deleted all but the one I wanted, so that I no longer have an alternative layout to swap to.

Charles Anderson
  • 19,321
  • 13
  • 57
  • 73
  • +1. I use this feature all the time :D. Changing the keyboard layout is per-application, which explains the OP's behaviour. I'd bet OP also has UK keyboard installed. – Bahbar Nov 08 '09 at 20:32
  • 1
    I use Alt + Shift fairly often to highlight multiple rows and columns for easy editing. Until now I've had no idea why weird chars would show up! – Nateous Oct 18 '17 at 19:07
  • [Multi-caret selection](https://learn.microsoft.com/en-us/visualstudio/ide/finding-and-replacing-text?view=vs-2019#multi-caret-selection) is exactly what kept causing me to run into this. Plenty of ways to accidentally miss the third input in a `Shift` + `Alt` + `...` sequence. – D M Jun 11 '21 at 16:40