VS AddIn - Line Number in ActiveDocument

K

Ken Wilson

I am currently working on a Visual Studio add-in. Does anyone know of
a simple way to get the line number the cursor is on in the
ActiveDocument? I don't necessarily need full code as long as someone
can point me in the right direction. Thanks in advance.

Ken Wilson
Seeking viable employment in Victoria, BC
 
K

Ken Wilson

That was a little more than I was looking for in regards to a running
Visual Studio but I have bookmarked it for future reference. I was
able to find similar code to what I needed for working with the Visual
Studio object. I'm posting it here in case anyone looks this thread
up seeking an answer. Thank you for your help.

---

object _applicationObject = (DTE2) Application; // passed by VS

....

int lineNumber;

lineNumber = ((TextSelection)
_applicationObject.ActiveDocument.Selection).CurrentLine
 
C

Carlos J. Quintero [VB MVP]

Hi Ken,

For the future, there are better newsgroups for add-ins questions such as
the following:

microsoft.public.vsnet.ide
microsoft.public.vstudio.extensibility

Not to mention the excellent Yahoo group for .NET add-ins (free join):

http://groups.yahoo.com/group/vsnetaddin/

Also, you have lots of resources for add-in developers at my web site:

http://www.mztools.com/resources_addin_developers.htm

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top