Gah! This is really causing me hassle today. Suddenly without warning \'@\' (at symbol) and \'\"\' (double quote) are trading places on my keyboard but ONLY in Visual Studio
This is Windows itself changing the keyboard layout - it's not really anything to do with Visual Studio, but it happens when you're using Visual Studio because the key combinations you use when tying in code are similar to the default key combinations Windows XP uses for switching keyboard layouts in the fly.
These instructions are for disabling keyboard layout switching in Windows XP. It's similar in other versions of Windows:-
Actually I can reproduce this following these steps. I suspect that it might have to do with the language culture of the compiled application. I have UK and US keyboard on the language bar.
I have built a simple C# Windows Forms application. I set the keyboard settings to US. I have a US keyboard although the rest of the regional settings on the machine are UK (The US version of the Micosoft keyboard I have has one less key than the UK version and it is a backslash, grr.) When I launch the application in the debugger the keyboard settings have miraculously changed back to the UK settings. This happens every time so it is not that another key is being pressed. I should also mention that this occurs in Windows Vista.
In XP if more than 1 keyboard input language is installed (ex: Dvorak and Qwerty) XP will flip flop randomly, particularly back to the OS's default language, and it mostly only happens when using a Microsoft application. And I'm 100% sure I'm not hitting Alt+Shift or any other key combination. This same problem will probably haunt you no matter what keyboard mappings or languages you have.
The only fix is to remove the secondary language and only add it when you need it. The other solution is to use Vista, which I notice no longer suffers from this bug (that's been in there since I started using Dvorak back in 2003 and not even XP SP3 fixed it either).
Remove all but one keyboard from:
Control Panel
>> Region And Language
>> Keyboards and Languages
>> Change Keyboards
To changeback to the language you want in VSC:
1- you have to press Ctrl+Alt+P,
2- then in the display that will appear at the top, write the language you want in case it does not appear,
3- once this is done, VSC will ask you to restart.
4- once restart is done it should be fine.
It solves the issue for me the whole time
U62- Perhaps people don't mark your solution as an answer if it's not an answer for them?
It's not a CTRL+SHIFT or any other key binding problem for me.
I do not even have US-International keyboard installed, yet Visual Studio constantly reverts back to it (I can see it in the Language bar, but when I go into Control Panel, it is not in the list of installed keyboards).
It's definitely something wrong with Visual Studio, because if I then move to Notepad, Notepad knows that the keyboard is UK. Move back to VS2010 again and it is back on US International.
EDIT: the answer is to go into Visual Studio settings, and select the International Settings pane. Make sure the Language is set to "Same as Microsoft Windows". "English" seems to be the US International keyboard English.