Solved

tool to sort functions?

Posted on 2001-07-27
28
246 Views
Last Modified: 2008-03-03
I would like a tool that re-orders the functions in my forms and modules. I like things in alphabetical sequence. Freeware would be nice :) Or can Visual Studio do this for me? Thanx-
0
Comment
Question by:wizard61
  • 14
  • 5
  • 4
  • +3
28 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 6328511
I think that VB actually does this when you add new functions/subs from Tools|Add Procedure.

As such, you could probably cut the code out and add the function, then select it and paste the code back.

Still manual and time consuming, but better than dragging.

Alternately, you can split the code window and then select and drag from one window to the next.

...
That said, it seems like a good place for a new tool.  I'd use it too if it were cheap enough (free?) although it would also be easy enough to write...like 4 hours work...hmm maybe I'll do it this weekend and make a copy available if you haven't already done the above.
0
 

Expert Comment

by:JeffGrigg
ID: 6329032
(Gosh, I really should look before I leap!  ;-)

If you can answer this question, then you'll also have the answer to...
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=visualbasic&qid=20159441
0
 
LVL 5

Expert Comment

by:KDivad
ID: 6329283
I've considered writing such an addin. I ain't done it yet (yes, I'm southern <grin>) because I'm still figuring out how to do addins...
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6342564
I've got most of it written.  The hard part was building the interface so it's bullet-proof.  Anyone interested in having me upload it to a server somewhere?  (If not, I'll keep it for myself.)
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 6342696
send it to me (emoreau99@hotmail.com) and I may upload it to a server.
0
 

Expert Comment

by:JeffGrigg
ID: 6342736
When it's available on an Internet server, please post the URL here; I'm sure lots of people would be interested in using it!

ThankYouThankYouThankYouThankYouThankYou!!!
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6342747
Well, then I'll just have to give it a version number.  

Maybe this will be my big break and I'll earn millions and I'll go on to be rich and famous and write a new operating system which will uproot Microsoft.

Ah, it's nice to dream.  Maybe just a shareware product.
0
 

Expert Comment

by:JeffGrigg
ID: 6343105
>>>  *AFTER* it's running and up on a server,  <<<
     would you consider SourceForge?

http://sourceforge.net/
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6345363
I opened a Q in the expert area for the VB Source sorter, so I can better track it and send updates:

http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=expinput&qid=20162326

Feel free to subscribe to that one so I can pass along updates.

Meanwhile, JeffGrigg , what does SourceForge do?  I looked at it but don't understand its mission or implementation of that mission.

And wizard61, have you abandoned this Q?  How about a response?
0
 

Expert Comment

by:JeffGrigg
ID: 6345456
SourceForge is a shareware repository for shareware projects.  I confess that I haven't participated in any SourceForge projects, but I've downloaded several.  ;->

What SourceForge does for you:

 > It provides server space to store and distribute your source and object code free to anyone who wants it.

 > It provides infrastructure and rules that allow you to share the development burdon with some set of software developers that you trust.  You control the list of "authorized" developers.  Everyone can contribute; it doesn't all have to be done by one person.  (See "Administering Developers for Your Project" at http://sourceforge.net/docman/display_doc.php?docid=779&group_id=1)

(Lots of documentation is available at http://sourceforge.net/docman/?group_id=1)
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6345743
OK, I uploaded a preliminary version of the code sorter.  Again, for more details see

 http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=expinput&qid=20162326

0
 
LVL 22

Accepted Solution

by:
rspahitz earned 10 total points
ID: 6360148
wizard61, did you like the solution I proposed.  I'm creating it as freely distributable shareware with a price yet to be determined, but I'll let you try the 1.0.2 version for free indefinitely (and likewise to all EE viewers)!  (See the above link for download info.)
0
 

Expert Comment

by:JeffGrigg
ID: 6360324
Ah, but will the *SOURCE* be available?  I think it would be educational.

(For my vote on rspahitz's proposed answer:  I accepted his implementation as the "answer" to my "order of VB functions" question.)
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6360482
I worked hard for that source :( Although I had most of it written in the 4 hours indicated, I put a lot of effort into making it look and act professional, so I hesitate to simply give the source away for nothing.

Jeff, contact me at my e-mail on the download site, and I'll send you a copy.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 15

Expert Comment

by:ameba
ID: 6365083
rspahitz >I worked hard for that source
Did you do market research?  ;-)

http://www.vb2themax.com/FileBank.asp?PageID=FileBank
"The Procedures Sort Add-In"
Click on diskette icon to download file ProcSort.zip (it's free, but no source)

"The Procedures Sort Add-In is a great add-in for those who like well-organized code. You can use it to sort your procedures in the active CodeWindow alphabetically. It preserve all you procedure attributes, which you normally loose when you do it manually. Event-handlers and Interface-implementations will be placed at the end of your code. You can set an option whether you want to have the constructors and destructors at the top."
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6365413
>"Did you do market research?"

Sure...I querued EE ;)

>"The Procedures Sort Add-In"
Now you show up with this thing!
(And it looks good in concept, although I couldn't get it to work according to the very limited instructions.)


0
 
LVL 15

Expert Comment

by:ameba
ID: 6365845
>I couldn't get it to work

You can install the addin by registering the DLL with the REGSVR32 utility:
        RegSvr32 ProcedureSort.dll

and then adding the following line to the VBADDIN.INI file in the \Windows directory:
        ProcedureSort.Connect=0

You have to load the Add-In using the 'Add-In Manager' in VB (Menu Tools). You will see a sort button (A-Z) in the Standard toolbar. The procedures of the active code-window will be sorted when you click this button.

Did you know that instead of using RegSvr32.Exe
- you can use references dialog to register dll (menu Project, References, Browse, and select dll file - this will register dll)
- you can use VB toolbox to register OCX - just drag OCX file from Explorer onto the toolbox.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6366064
>"The procedures of the active code-window will be sorted when you click this button."

I got that far (added the "sort" button), but when I clicked the button while the cursor was in the code window, nothing seemed to happen.  I tried it in the code window for a class and a form, but the procedures did not move from their unsorted positions.

0
 
LVL 15

Expert Comment

by:ameba
ID: 6366253
>nothing seemed to happen
Maybe they are already sorted.  It sorts procedures OK here.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6366305
I don't know what happened before, but I reinstalled and it looks decent.  Obviously better than mine since it works on code in the VB project rather than outside.

My only complaints are that it likes to add extra spacing between my procs, and that the "undo" feature needs to be reviewed!

You can "undo" (ctrl-Z) some of the changes that it makes (since it sorts your procs in phases), which will thereby delete the most recently sorted procedure you just added--a dangerous feature...if you didn't realize what it was doing.  As such make sure to save immediately after your sort.

(A better implementation would have been to copy/paste/delete rather than cut/paste, but this is also an early version.)

--
Oh yeah, and his is 8K bigger than mine ;)
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6366310
Hey, wizard61, are you with us?  You have two good solution.  Why not pick one.
0
 

Author Comment

by:wizard61
ID: 6366805
Sorry, I've been preoccupied. A lot to read up above. I cannt get to you links, rsparhitz. I'll try the thing from ameba. Again, sorry for the delay.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6368550
Do you mean you can't get to the EE link above or the link where I have the tool:

http://www.mjscreations.com/rjscreations/sdplug

I hope this helps.
Note that although the web page lists both the tool and the supporting file (Common Dialog Control 32), you probably already have the supporting file.
0
 

Author Comment

by:wizard61
ID: 6372575
Thanks, and sorry for the delay. I have not tried it yet, but it downloaded fine. C-ya :)
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6373246
Well, thanks for the points.  By all means, let me know if you have any questions related to it.

P.S. If you find that it is not as useful as ameba's choice (3 comments after the accepted answer), since mine is an off-line sorter and the link points to an on-line sorter, feel free to drop a line in the Customer Service topic area to switch the accepted answer/points.
...CS this is my acceptance of such a decision from wiard61 should it occur.

Meanwhile, feel free to offer suggestions on improving my offering.  It already allows you to add line numbering, either on all lines (except line continuations), or only those lines that don't begin with a comment.  This could certainly be useful in error-trapping routines in combination with the ERL function.
You'll also see I have other options disabled--those are just proposed ideas.

Enjoy!
0
 
LVL 15

Expert Comment

by:ameba
ID: 6373264
>If you find that it is not as useful as ameba's choice

No, don't switch, I would hate to get B grade!
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6373271
OK--I guess if you decide to switch, you'd better make in an "A"!
0
 

Author Comment

by:wizard61
ID: 6376274
As a newbie here, I did not realize that "B" had the slightest shame.  
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Vb.net 2008 2 49
Excel object stays open 19 65
VBA filters 2 39
Exit a vb6 apps when a calling it apps closes 15 35
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now