Results 1 to 8 of 8

Thread: Get rid of automatically filled-in End Sub, End If

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    South Charleston, WV, USA
    Posts
    607

    Get rid of automatically filled-in End Sub, End If

    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.

  2. #2
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,958

    Re: Get rid of automatically filled-in End Sub, End If

    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.

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: Get rid of automatically filled-in End Sub, End If

    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.
    My usual boring signature: Nothing

  4. #4
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Get rid of automatically filled-in End Sub, End If

    Quote Originally Posted by Shaggy Hiker View Post
    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.
    Me too.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    South Charleston, WV, USA
    Posts
    607

    Re: Get rid of automatically filled-in End Sub, End If

    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.

  6. #6
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Get rid of automatically filled-in End Sub, End If

    Quote Originally Posted by projecttoday View Post
    ...They pop up in the wrong place half the time. I'll be glad to control the code myself.
    In all the years I have written VB I can't ever recall them popping up in the wrong place. What version are you using?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  7. #7
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: Get rid of automatically filled-in End Sub, End If

    I've got to agree, they always show up 2 lines below the start construct, where else would you want them?
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  8. #8
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,598

    Re: Get rid of automatically filled-in End Sub, End If

    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.
    Last edited by passel; Apr 30th, 2017 at 02:47 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width