Dealing with curly braces ;}

J

JavaGeekRoyR

Hello all..

In the VS.Net IDE, is there a way to auto-format your code (such that
the curly braces for code blocks automatically align, code is
automatically indented to proper levels etc)? If not in 2003, will this
feature be available in 2005?

It sux to deal with so much variation in code formatting style between
different programmers. At least VB.net makes formatting consistent by
default. I promise to stop complaining if you will tell me how to do
this in C# :)
 
J

Jim H

select all code in the window (ctrl-a)

then
ctrl-k ctrl-f

Also in the menu under Edit->Advanced->Format Selection

Formats all selected code in window.

I know your pain. ;)

jim
 
N

Nicholas Paldino [.NET/C# MVP]

JavaGeekRoyR,

There is no support for this in VS.NET 2003, but in VS.NET 2005, there
is a huge amount of support for formatting. You can find it under "Tools |
Options"

Then in the dialog that shows up, go to "Text Editor | C# | Formatting"
and you can see a number of options relating to the formatting that the IDE
applies to your code.

Hope this helps.
 
G

gerry

what am i missing here ?
in vs.net 2003 ( and afaik all previous versions ) typing a closing brace
formats all code back to the matching opening brace.



Nicholas Paldino said:
JavaGeekRoyR,

There is no support for this in VS.NET 2003, but in VS.NET 2005, there
is a huge amount of support for formatting. You can find it under "Tools |
Options"

Then in the dialog that shows up, go to "Text Editor | C# | Formatting"
and you can see a number of options relating to the formatting that the IDE
applies to your code.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


JavaGeekRoyR said:
Hello all..

In the VS.Net IDE, is there a way to auto-format your code (such that
the curly braces for code blocks automatically align, code is
automatically indented to proper levels etc)? If not in 2003, will this
feature be available in 2005?

It sux to deal with so much variation in code formatting style between
different programmers. At least VB.net makes formatting consistent by
default. I promise to stop complaining if you will tell me how to do
this in C# :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top