Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I sort the functions in my source code?

Status
Not open for further replies.

I3enners

Programmer
Mar 20, 2007
2
GB
Hi there, is there any way to sort the functions and properties I create in the VB IDE into alphabetical order using an addin or macro or something?

I find it a pain to find my functions in the source code view because I didn't write them in any order.

 
I'm not sure if there is any automated tool, but one thing I use alot is the #Region command. You can put any methods/properties/declarations into a #Region code block for organization. And VS.Net will allow you to expand and contract these for easier scrolling.

for example:
Code:
#Region "Declarations"
Private m_strVariable as String

#End Region

#Region "Properties"
Public Readonly Property Variable as String
  Get
    return m_strVariable
  end Get
End property

#end region

'....

Grouping your code blocks together can make it much easier to find what you're looking for. In addition, you may also want to get in the habit of using the drop down list at the top of the screen for finding methods that you can't remember where in the file they are.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Can't you either cut and paste them in the order you want??? Have you tried using the find command???? Try putting letters or numbers in a comment block and search for that. To make finding functions, etc easier, try setting a book mark...
 
I was just hoping Microsoft had thought of a sort routine thats all. Seems like a pretty useful addition to me. I can see you could do it using an Addin but it would be fiddly because you would have to parse the document as pure text and find the functions in it to move them around.

Thanks for your suggestions anyway
 
For VBA I dowloaded a tool called MZTools and was able to sort all the procedures with it. For vba it was a free download. I seem to remember it was available vb or vb.net for a fee, but it has been a while so I am not sure of the availability or the price.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top