1

I'm running some sort of analysis and display the results in a list inside a tool-window. the results looks like this:

#sourcefile::lineNum , ratio
c:/.../file1.cpp::45 , 81%
c:/.../file2.cpp::12 , 49%

what I want to do is, on click, open the source file in the explorer window and jump to the specific line.

any ideas how to do it? thanks.

1 Answer 1

5

The idea is that given the EnvDTE.ProjectItem of the file, you call its Open method with the desired view (text or code), getting its EnvDTE.Window, you make it Visible = true. Then you get the Document property of the window, get the TextDocument of the Document (Object property), get the StartPoint (EnvDTE.TextPoint), move it to the desired (line,column) and call the TryToShow method.

For details, search the article:

HOWTO: Manipulate a code or form designer file from a Visual Studio add-in http://www.visualstudioextensibility.com/articles/add-ins/

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.