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
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. :)
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.
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.
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.
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.