posts - 31, comments - 85, trackbacks - 0

My Links

News

Archives

Post Categories

Auto indent code in Visual Studio or Express editions

I learned a nice trick today to auto indent code on aspx or code pages. Simply select the piece of code to be indented, press Ctrl+K and then press Ctrl+F and all the html or code will be nicely indented.
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted on Wednesday, December 17, 2008 2:17 PM | Filed Under [ Visual Studio / Express ]

Feedback

Gravatar

# re: Auto indent code in Visual Studio or Express editions

Also Ctrl-K + Ctrl-C or Ctrl-K + Ctrl-U to comment and uncomment code is a great one.

I'm not familiar with your language preference, but the VB team recently posted a list of shortcut posters you might find interesting.

http://blogs.msdn.com/vbteam/archive/2008/12/11/vb-2008-keyboard-shortcut-posters-download-your-copy-today-lisa-feigenbaum.aspx
12/17/2008 2:24 PM | Stacy Vicknair
Gravatar

# re: Auto indent code in Visual Studio or Express editions

Good tip! thanks for publishing it!
10/23/2009 2:21 PM | Jportela
Gravatar

# re: Auto indent code in Visual Studio or Express editions

You are welcome...
10/23/2009 2:46 PM | Max
Gravatar

# re: Auto indent code in Visual Studio or Express editions

Thanx for the tips
10/27/2009 4:50 AM | Roy
Gravatar

# re: Auto indent code in Visual Studio or Express editions

awesome. Thanks for the tip
3/6/2010 11:22 AM | Thao
Gravatar

# re: Auto indent code in Visual Studio or Express editions

these are really nice tips.
5/3/2010 12:23 PM | Sajjad
Gravatar

# re: Auto indent code in Visual Studio or Express editions

just ALT+F8 can indent the codes
6/24/2010 2:43 AM | nezzar
Gravatar

# re: Auto indent code in Visual Studio or Express editions

Thank you for the tip, nezzar.
12/15/2010 10:46 AM | Keith Brawner
Gravatar

# re: Auto indent code in Visual Studio or Express editions

I've been trying to find out the trick for a long time now. Finally, I see how it should be done. This should be called discovery of the day. You really saved us some time! Thank you.
12/28/2010 5:45 AM | Philidelphia Nissan
Gravatar

# re: Auto indent code in Visual Studio or Express editions

Glad it helped.
12/28/2010 5:50 AM | Max
Gravatar

# re: Auto indent code in Visual Studio or Express editions

You can simply do Auto Indent in shot. Press

"CTRL + F8" ;)
3/15/2011 7:14 AM | Ankit Singh
Gravatar

# re: Auto indent code in Visual Studio or Express editions

Thanks a lot for the tips! I started developing Java using Eclipse, and used its auto-indent and multi-line commenting regularly. Ever since I switched to developing C# with Visual Studio, I've been a little frustrated that I didn't know these functions. You've lifted a huge load of my shoulders! :-)

I can't seem to get the ALT+F8 / CTRL+F8 trick to work though.
4/15/2011 8:29 AM | Lars Kristensen
Gravatar

# re: Auto indent code in Visual Studio or Express editions

Yup, that F8 didn't work for me either.
4/15/2011 1:43 PM | Max
Gravatar

# re: Auto indent code in Visual Studio or Express editions

I looked into it a little more. Turns out it's pretty easy to modify these shortcuts. Just go to:

Tools --> Options --> Keyboard

Here you can browse through all the commands - look them up on MSDN, if you don't know which one you want to alter;

http://msdn.microsoft.com/en-us/library/c3a0kd3x(v=vs.80).aspx

I altered the keyboard shortcut for the "Edit.FormatDocument" command, which is used to auto-indent the entire document.
4/19/2011 6:30 AM | Lars Kristensen
Gravatar

# re: Auto indent code in Visual Studio or Express editions

That should be mentioned somewhere in Visual Studio.
12/31/2011 2:09 PM | Dan
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: