views:

47

answers:

1

In the Visual Studio output window, you can double click a line that contains a file path and line number and it automatically takes you to that location. In my program, I need to mimic this behavior and be able to click something (a button for example) and do go to a specific file and line number that I tell it to go to. Any help/suggestions would be appreciated.

I am working in C#.

A: 

You can write a macro (Tools/Macros/Macros IDE) to do this. The following commands will select a specific file and go to the given line number.

    DTE.Windows.Item("myfile.cs").Activate()
    DTE.ExecuteCommand("Edit.Goto", "1234")
Mark Wilkins
I tried out this macro but I don't think this will work for what I need. I would need to be able call the macro from within my C# code and pass in a file name and line number as parameters. I looked up how to call the macro from within my code but I didn't have much luck... Thanks for the help though!
Jack
@Jack: Ah - that makes sense. I do suspect that you can call the macro from C#, but I don't know how it would be done either.
Mark Wilkins