Solved

Where is the setting in VS for IF statement brace position?

Posted on 2011-09-08
5
211 Views
Last Modified: 2013-11-26
I want to have my IF statement blocks braces on the same line as the IF statement... where is the setting to do this?

Fir example:

if(DateTime.Today() is "monday")  {  //  <----------    this is where I want the brace, not on the next line
    doSomething();
    doSomethingElse();
)
0
Comment
Question by:rmmarsh
  • 3
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
yesthatbob earned 500 total points
ID: 36504866
Which version of VS? In VS2010, you would find it at:

Tools > Options >Text Editor > C# > Formatting > New Lines

From there,uncheck the "Place open brace on new line for control blocks" option. See this screen shot:

 Brace options
0
 

Author Comment

by:rmmarsh
ID: 36504977
That's what I have and it's not working... I do a Edit -> Advanced -> Format Document, and it doesn't change anything!

A bug maybe?
0
 
LVL 4

Expert Comment

by:yesthatbob
ID: 36505068
Not sure what to tell you there, using Format Document works for me...
0
 

Author Closing Comment

by:rmmarsh
ID: 36505081
Thanks anyway... I appreciate your time
0
 

Author Comment

by:rmmarsh
ID: 36505638
Found the problem... I was CHECKING the box, not un-checking it.  I just hate it when I do something dumb like that!

Thanks again!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question