I'm using VB.NET 2010 Express Edition Visual Studio editor. Is there any setting that can stop the editor from filling in "End If" and "End Sub". I want to type these in myself.
Printable View
I'm using VB.NET 2010 Express Edition Visual Studio editor. Is there any setting that can stop the editor from filling in "End If" and "End Sub". I want to type these in myself.
Under tools, Options, Text Editor, Visual Basic, Advanced you should see an option for "Automatically Insert End Constructs" turning that off should do the trick.
Why do you want to do this? One of the complaints that has always been lodged against VB (incorrectly, for the most part) is that it is too wordy, and you are asking for a way to be required to type more? I'm totally curious about that.
Thank you, Plausiblydamp. They are a nuisance. They pop up in the wrong place half the time. I'll be glad to control the code myself.
I've got to agree, they always show up 2 lines below the start construct, where else would you want them?
Usually the case would be where you already had written some code, and decided to put that code in an If block.
You type in the If condition in front of the code you want to block, and when you hit return, it inserts a blank line and End If, and you have to remove those and then go down to where you want them and reinsert.
Likewise, when you are modifying an existing If ... End If block to add more levels inside, or are restructuring the logic, The End If can be inserted for you, but it doesn't belong there because you have existing code you want to block, so you have to remove and reinsert.
Of course you could just get into the habit of hitting down arrow instead of Return, and it shouldn't add the End If for you, but it will usually indent all the following code until if finds an End If (assuming there is one). Sometimes that will throw you off as you have to go down and find the spot where you really want the End If, knowing that the code has been shifted so may not be as recognizable as it was just be for you put in the If.
Sometimes, I'll put the End If in first, at the bottom where I know I want the block to end, then move up and put the If condition in.
While it happens enough to me to be a minor annoyance, it isn't bad enough to make me want to disable the auto End If insertion. I miss the auto insertion during the infrequent times I revisit VB6 programming.