Solved

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

Posted on 2011-09-08
5
210 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
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 …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

810 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