Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. VS2010 auto insert {}

VS2010 auto insert {}

Scheduled Pinned Locked Moved The Lounge
question
14 Posts 10 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B BRShroyer

    How can you make VS2010 create a block after an if or for statement? I would like it to automatically add the braces with an indented line between them after I type a block statement if the last character on the line was a ")". So: if (this == true) would become when the [ENTER] key was pressed: if (this == true) { (cursor here indented however many spaces) } Thanks,

    Brad Deja Moo - When you feel like you've heard the same bull before.

    realJSOPR Offline
    realJSOPR Offline
    realJSOP
    wrote on last edited by
    #4

    He once challenged his own reflection to a staring contest. On the fourth day, he won. He wouldn't be afraid to talk about his feminine side - if he had one. He *is* the most interesting man in the world.

    .45 ACP - because shooting twice is just silly
    -----
    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
    -----
    "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

    R H 2 Replies Last reply
    0
    • B BRShroyer

      How can you make VS2010 create a block after an if or for statement? I would like it to automatically add the braces with an indented line between them after I type a block statement if the last character on the line was a ")". So: if (this == true) would become when the [ENTER] key was pressed: if (this == true) { (cursor here indented however many spaces) } Thanks,

      Brad Deja Moo - When you feel like you've heard the same bull before.

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #5

      VB.NET does this automatically I've heard. Which is why VB is supposedly more RAD than C# :rolleyes: C# with the DevEx add-in or Whole Tomatoe does the same though. If you want to go that route.

      Regards, Nish


      Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application

      1 Reply Last reply
      0
      • realJSOPR realJSOP

        He once challenged his own reflection to a staring contest. On the fourth day, he won. He wouldn't be afraid to talk about his feminine side - if he had one. He *is* the most interesting man in the world.

        .45 ACP - because shooting twice is just silly
        -----
        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
        -----
        "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

        R Offline
        R Offline
        R Giskard Reventlov
        wrote on last edited by
        #6

        Bit of an own-goal there, perhaps?

        me, me, me "The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!" Larry Niven nils illegitimus carborundum

        1 Reply Last reply
        0
        • realJSOPR realJSOP

          He once challenged his own reflection to a staring contest. On the fourth day, he won. He wouldn't be afraid to talk about his feminine side - if he had one. He *is* the most interesting man in the world.

          .45 ACP - because shooting twice is just silly
          -----
          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
          -----
          "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

          H Offline
          H Offline
          hairy_hats
          wrote on last edited by
          #7

          He may not have a feminine side, but does he have an off-side?

          1 Reply Last reply
          0
          • H hairy_hats

            What's wrong with: if, tab, tab? Works in VS2005.

            R Offline
            R Offline
            R Giskard Reventlov
            wrote on last edited by
            #8

            and in 2008 and VS2010

            me, me, me "The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!" Larry Niven nils illegitimus carborundum

            R 1 Reply Last reply
            0
            • H hairy_hats

              What's wrong with: if, tab, tab? Works in VS2005.

              B Offline
              B Offline
              BRShroyer
              wrote on last edited by
              #9

              viaducting wrote:

              What's wrong with: if, tab, tab? Works in VS2005.

              Well, I'll be. Never knew you could do that. Not quite as good as I was hoping, but it definitely works. Thanks.

              Brad Deja Moo - When you feel like you've heard the same bull before.

              1 Reply Last reply
              0
              • H hairy_hats

                What's wrong with: if, tab, tab? Works in VS2005.

                T Offline
                T Offline
                TheGreatAndPowerfulOz
                wrote on last edited by
                #10

                holy shiite, i never knew that! It works for the other control statements too!

                Fight Big Government:
                http://obamacareclassaction.com/
                http://obamacaretruth.org/

                R 1 Reply Last reply
                0
                • T TheGreatAndPowerfulOz

                  holy shiite, i never knew that! It works for the other control statements too!

                  Fight Big Government:
                  http://obamacareclassaction.com/
                  http://obamacaretruth.org/

                  R Offline
                  R Offline
                  R Giskard Reventlov
                  wrote on last edited by
                  #11

                  and for prop and many others as well.

                  me, me, me "The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!" Larry Niven nils illegitimus carborundum

                  1 Reply Last reply
                  0
                  • R R Giskard Reventlov

                    and in 2008 and VS2010

                    me, me, me "The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!" Larry Niven nils illegitimus carborundum

                    R Offline
                    R Offline
                    Robert Surtees
                    wrote on last edited by
                    #12

                    It won't work in VS2012 though. Just because.

                    1 Reply Last reply
                    0
                    • H hairy_hats

                      What's wrong with: if, tab, tab? Works in VS2005.

                      J Offline
                      J Offline
                      Joe Woodbury
                      wrote on last edited by
                      #13

                      What is this supposed to do? It doesn't do anything on my system except add two tabs (regardless of what version of VS I use.)

                      1 Reply Last reply
                      0
                      • B BRShroyer

                        How can you make VS2010 create a block after an if or for statement? I would like it to automatically add the braces with an indented line between them after I type a block statement if the last character on the line was a ")". So: if (this == true) would become when the [ENTER] key was pressed: if (this == true) { (cursor here indented however many spaces) } Thanks,

                        Brad Deja Moo - When you feel like you've heard the same bull before.

                        P Offline
                        P Offline
                        peterchen
                        wrote on last edited by
                        #14

                        Visual Assist does that.

                        Agh! Reality! My Archnemesis![^]
                        | FoldWithUs! | sighist | µLaunch - program launcher for server core and hyper-v server.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups