Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now