Solved

copy code and line numbers in visual studio 2010

Posted on 2012-04-09
3
1,053 Views
Last Modified: 2012-04-10
Hi experts,

I'm using VB in Visual Studio 2010.

I turned on the line numbers in my VB text editor by going to Tools - > Options and checking the Line Numbers check box.

So now when I'm writing vb code on the left i see the line numbers and my code to the right of each line number.

If I select my code and right click my mouse and click copy that copies my code and then I can paste it in notepad or Microsoft Word when I need to write some notes. But I notice the line numbers aren't copied.

Is there a way to select both my code and the line numbers so I can copy and paste them both in notepad or word?
0
Comment
Question by:maqskywalker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Accepted Solution

by:
Anuradha Goli earned 500 total points
ID: 37826723
There is an addon supported in visual studio to copy syntax highlighting and line numbers .Download it from the link http://copysourceashtml.codeplex.com/
It is version for VS2008 ,you need to make some changes to support VS2010.
Download latest CopySourceAsHtml msi and install it

1.By default it will be installed to C:\Users\<username>\My Documents\Visual Studio 2008\Addins
2.Create a folder named Addins under C:\Users\<username>\My Documents\Visual Studio 2010 and copy CopySourceAsHtml.AddIn here.
3.Modify Line #5 and #9 change <Version>9.0</Version> to<Version>10.0</Version>
4.Launch Visual Studio 2010 –> Tools –> Addin Manager, if you see CopySourceAsHtml shows up, then it’s enabled successfully.
Copy as HTML6.Now you can select the code and get html by clicking Copy As Html
Right click
This is an example. CopySourceAsHtml also provides options to show/hide control line number, word wrap and so on.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace HelloWorld
7 {
8 class Program
9 {
10 static void Main(string[] args)
11 {
12 // My first application
13 System.Console.WriteLine(“Hello, World!”);
14 }
15 }

Open in new window


Hope this will help you with your requirement.
0
 
LVL 13

Expert Comment

by:agarwalrahul
ID: 37826967
0
 
LVL 16

Expert Comment

by:SriVaddadi
ID: 37827106
Line numbers are just display only. They r not part of url code and cannot copy as is I.e. with out any add ons.

Also once you copy the code if u paste it to a text editor which supports line numbers u shod see the line numbers. One such editor is textpad. I m sure there r many more out there.

Notepad does not show line numbers though it supports goto line number feature

So IMHO there is no need get fancy by installing some plug ins to just copy line numbers.
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question