Results 1 to 6 of 6

Thread: Sort,Order,Alphabetize routines in IDE code

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2001
    Location
    N42 29.340 W71 53.215
    Posts
    422

    Question Sort,Order,Alphabetize routines in IDE code

    When creating new subs and functions in the IDE, is there any way to help keep them in alphabetical order?

    In VB6, creating a new method at least tried to insert it in proper order, here in .NET it seems to just insert it at the end of the existing code.

    Thanks, DaveBo
    "The wise man doesn't know all the answers, but he knows where to find them."
    VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Sort,Order,Alphabetize routines in IDE code

    Yes, that is soo irritating. No matter where you place the cursor, it will always add the procedure to the end of the file.
    Perhaps you could make an IDE Add-In that would alphabetize them or insert the procedure where the cursor is? I know i would like that.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Sort,Order,Alphabetize routines in IDE code

    If any specific module (which is usually all of them) goes anything beyond a few screens of scrolling, I always make code regions and group my code according to what it does... for example i may put all routines that handle form/control events all in 1 region, while any little functions/subs will go in another... depending on the code itself, I group things differently.. makes it pretty easy to keep things organized.

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

    Re: Sort,Order,Alphabetize routines in IDE code

    I agree, and I group even when there is less than a screen if it makes sense.

    However, if you have a form with ten buttons, and you decide to group them into a region, that is fine. But then, if you add an eleventh button, the handler will go at the bottom of block of code, nowhere near the other buttons, and it then has to be copied and pasted into the region. It sure would be nice if you could specify where to put the handler, perhaps by cursor location.
    My usual boring signature: Nothing

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Sort,Order,Alphabetize routines in IDE code

    To say that alphabetically is the "proper" order is highly subjective. I'd never even consider keeping members alphabetically ordered. It's also not really practical to create a new event handler at the cursor position because what if the cursor is in the middle of another method. The VS.NET IDE provides the facilities to create macros to do all sorts of things, but standard functionality like that would annoy far more people than it would please I think.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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

    Re: Sort,Order,Alphabetize routines in IDE code

    I agree as far as alphabetical ordering, but I do think there is a rational way to insert a handler near the cursor. You are right that putting it AT the cursor would be a mess, but I think that putting it at the next spot below the cursor (not in a sub or function block) would work for most people, and would save some of us a measure of aggravation.

    Kind of minor, though.
    My usual boring signature: Nothing

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