Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


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

Posted on 2011-09-08
Medium Priority
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
Question by:rmmarsh
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Accepted Solution

yesthatbob earned 2000 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

Author Comment

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?

Expert Comment

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

Author Closing Comment

ID: 36505081
Thanks anyway... I appreciate your time

Author Comment

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!

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

610 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