The basics and not so basics of Visual Studio.
This one is a little different from the ones I’ve been writing lately but it’s helpful nonetheless. Sadly this is only for Windows PC as I don’t have a way to test on Mac PC. You may already know some of these maybe even all of them but when I started out, I knew almost none of these and had to work them out myself. This is for those people.
This one can be used in many ways, by itself or used with other keys.
By itself, it will cause an indent that will stop at the same point along the way.
Tab can even be used when you are coding to fill outline a lot faster.
This can be used to undo that indent.
If you select multiply lines and keep shift held down you get this,
This one does change a bit if the line is all the way to the left, then you will need at least 1 character to be able to move the line.
If you select multiply line but Don’t keep the shift key down, you get this.
Alt + Tab:
As you will already know, this one is a windows combo and doesn’t do anything in Visual Studio. If you didn’t know, this just changes between open windows on your desktop.
This one works a bit like Alt+ Tab for windows but for Scripts in Visual Studio.
If you press Ctrl+ Tab then lift only Tab off, you will get a list of the scripts, tap Tab again and you will scroll through the list. As soon as you lift the Ctrl key, it will change to that script.
“Sure that’s helpful and all but I don’t want to have to go through the whole list to be able to get to a script 2 above the one I’m on.” This is where the shift key comes into play.
If you press Ctrl+Tab to bring up this menu again, this time press and hold down the Shift key, now when you press the Tab key, it will go up the list instead of down.
This one I have found myself using the most so far. If you are on a line or multiple lines you want to be able to move, instead of rewriting all the code or copying them and pasting to the new spot. Use Alt+ Up/Down arrow keys.
This one when moved will swap itself with lines that are in the way.
The same goes for multiple lines.
Remembered this one after this one was posted.
When you are typing out some code and you click off something and lose the context menu, you can bring it back up if you press Alt+ Right.
Can be handy when you select the wrong variable that has almost the same name to be able to quickly change it without having to rewrite it.
Another use for using the Alt key is when you are selecting things and only want things past a certain point. (this one I think I’ve used the least but still helpful to know)
Instead of selecting a full line, it will only select it at a point.
This one you can use to go through the open scripts. It’s a little like Ctrl+Tab but able to be done with a mouse. (Actually, this might be the least used lol)
This one will work when you press Alt+Ctrl then press the Down arrow. After the menu is opened you can lift off the Alt and Ctrl and use the Up and Down arrows then select the script with the Enter key.
useful in many ways, this one really depends on what you are using it with.
When you use Ctrl + Up/Down arrows you get a scrolling effect.
When you use Ctrl+ Left/Right arrows you are able to jump around in code. Makes removing those empty space easy too, Ctrl + left then BackSpace, all gone!
Combine the Ctrl+Left/Right arrows with Shift and you can select things pretty fast.
Here is a useful way to be able to change variables in a script.
Simple select a variable you want to be changed then press F2, retype in what you want, and press Enter.
This one is helpful for finding where a script is being called from.
Click on the method name and press F12.
Comments can make things a lot easier to understand what is happening or if you want to remove some code for testing.
For single lines or select lines, we can use // . This will turn the code green signaling that it’s now a comment and won’t get looked at by the compiler.
For multiple lines we have 2 choices, /// and /* */ each has their places.
If you want to write out an intro for your code
or want to write out some lines of pseudo-code before implementing something.
For /* */ it’s a bit different, you can see do what /// does with multiple lines as everything between /* and */ gets turned into a comment.
This one I use all the time for testing things out since you can remove large chunks of code without having to delete it or do a million //
Although my personal favorite with it is being able to use //alongside it.
These are all the ones I can think of at the moment. If you know of some that aren’t in here leave a note and I’ll add them in too, giving credit to who suggests them.
Personally, I have found a lot of these really useful and hope you do too. Back to the normal programming in the next one. See you there!