More hints for using Visual Studio in the Classroom

I watched a pair of teachers teach part of a Visual Basic class this morning. Watching teachers in action really made me want to get in the classroom myself. The teachers I watched were doing a fine job. The students were engaged and learning. But I found myself wanting to jump in and explain things myself. Not that they were not doing it “right” just that they were doing it differently from the way I would.

One thing that I observed was that one of the teachers had increased the size of the fonts in Visual Studio and also turned on the display of line numbers. Those are settings I have talked about before. Seeing the difference in readability from one room (large fonts) and the other (default fonts) room really convinced me of the value of this option. I also watched a teacher comment a blog of code line by line. That reminded me that I haven’t talked about keyboard shortcut keys in Visual Studio.

From the Edit menu there is an option called Advanced that shows a number of helpful formatting options. One of the options I have found particularly useful is commenting and uncommenting a blog of code. If you highlight a block of code the key sequence Control K and Control C at the same time the whole block of code will be commented. Likewise if you highlight a block of commented code and use the key sequence Control K and Control U the block will be uncommented.

Normally code is automatically formatted as it is entered but this is not always the case. If you have a block of code that is not formatted nicely (perhaps something handed in by a student) you can have Visual Studio format the code for you. The Control K Control F sequence will format a block that has been selected. The Control K Control D sequence will format the whole document. I often found that formatting unformatted code made it a lot easier for me to review it and even to find logic issues.

Comments (0)