Click here to Skip to main content
12,947,379 members (48,805 online)
Click here to Skip to main content
Add your own
alternative version


10 bookmarked
Posted 27 Nov 2003

VS.NET add-in - search and jump to functions in current source file

, 27 Nov 2003 CPOL
Rate this:
Please Sign up or sign in to vote.
VS.NET add-in to go to any function in the current source file using wildcard search.

Sample Image - GotoFunction.png


This article is not so much an introduction to writing add-ins as it is just simply sharing a utility I found very useful for Visual Studio .NET. I primarily use VS.NET / C++ for development, however all our client applications are developed in Delphi 7.0, and I find the GExperts IDE enhancement suite for Delphi very good. Specifically, the ability to go to a function within the current source file. When you invoke the add-in, the above search dialog prompts you to enter a search string. As you type more characters, the list filters all the matches - which is a substring search. So, from the example list above, typing mes would reduce the list to PreProcessMessage and SendMessage.

If there is enough requests, I will fully document the program in this article as a true introduction to VS.NET add-ins.

Don't let the very basic dialog fool you. If you work in source files with a number of functions / members, you will find this add-in quite a time saver when jumping between functions.

This add-in will work with C++, VB.NET and C#. I don't see why it also wouldn't work with Visual J#.

Using the code

I have provided the full source code and an MSI installer, so you can immediately get running. To get the intended benefit from this utility, I recommend you assign it a shortcut (I use CTRL+G, to match the Delphi version). As you type in the search box, the function list will continually reduce. You can use the PGUP/DOWN and UP/DOWN keys without leaving the edit box. Hitting ENTER will centre the function in your editor window.

Points of Interest

The main point of interest is the frmGotoFunction.cs file, which contains all the guts of the app.

It uses the FileCodeModel object to extract out all the functions from the current source file, however when actually moving the edit point, I had to check if the source file was C++, as the definition and declaration can be separated into a header and source file. If the language is C++, I obtain an interface to the VCCodeElemet object and use the StartPointOf method to either get a TextPoint to the definition if the file extension is ".H" or otherwise to the declaration. This is currently not very robust, so I will investigate further, but currently works for me.

I won't list functions declared in a templated file like STL <list> or one of the ATL files. I haven't yet checked to see why.


Version 1.0 - Initial public release.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Stuart Carnie
United States United States
I received my first computer, an Atari 800 XL, when I was 8 years old in 1981 and discovered BASIC programming.

Following the Atari a couple of years later, I moved to the Commodore 128D, where I started experimenting with assembler. I progressed through IBM XT, AT, and then all models of clones in between up to the latest P4s. I still dabble in x86 assembler, however my primary development environment today is C++ and C# and to a lesser degree now Delphi 7.0.

I have mostly self taught myself, by example and experimentation although I did receive a Bachelor of Applied Computing at the University of Tasmania / Australia to 'get that piece of paper'.

Professionally, I've been in R&D, consulting, management, sysadmin and training roles since the early 90'. Prior to entering IT professionally, I built a custom application for an abattoir in the late 80's entirely in Turbo Pascal 5.5 to track and report on beef production, due for export to Japan.

I now also enjoy using computers for mixing and recording my own music and satisfying my passion for photography.

You may also be interested in...

Comments and Discussions

GeneralSuperb! Pin
Member #348750628-Dec-06 21:24
memberMember #348750628-Dec-06 21:24 
QuestionVS 2005 version? Pin
cnordvik7-Feb-06 3:10
membercnordvik7-Feb-06 3:10 
AnswerRe: VS 2005 version? Pin
pires_li12-Oct-06 22:34
memberpires_li12-Oct-06 22:34 
GeneralRe: VS 2005 version? Pin
Stuart Carnie30-Dec-06 5:39
memberStuart Carnie30-Dec-06 5:39 
GeneralInstall Add-In : Error Pin
nthevu9-Aug-04 21:47
membernthevu9-Aug-04 21:47 
GeneralA Couple Of Suggestions Pin
palmer_tr19-Dec-03 16:00
memberpalmer_tr19-Dec-03 16:00 
GeneralRe: A Couple Of Suggestions Pin
Stuart Carnie14-Jan-04 11:00
memberStuart Carnie14-Jan-04 11:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170518.1 | Last Updated 28 Nov 2003
Article Copyright 2003 by Stuart Carnie
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid