Can anyone tell me how to get my blocks of code to automatically indent when I place the final closing brace--"}". This works fine when I am coding in C# and I know there must be a way to enable this feature for CPP source documents.

Recommended Answers

All 3 Replies

The C# and C++ IDEs are written by separate teams and do not correspond in supported features. In other words, if you can't find that feature in the same place as you would find it for the C# IDE, you're SOL. However, you can still do a selection format by selecting the part of your code you want formatted and using the Ctrl+K+F combination (or Edit->Advanced->Format Selection). In my experience that works across the board.

To turn on automatic indenting of blocks

Tools | Options | Text Editor | C/C++ | Tabs select Smart Indenting

Yes, thanks. I knew where the options where, but figured wrong about the same capabilities between the editors. However, I found the Ctrl-F (suggested by narue) on selected blocks seems to do the trick. I used to use VS < 2003 to code in CPP years ago, but after using VS 2008 and C# editor recently and then going back to CPP, it's really annoying there is not the same editor functionality. Anyway, thanks for the information guys!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.