Turn on Line Numbers

Menu:  Tools -> Options -> Text Editor -> All Languages -> General -> Display
Versions:  2008,2010
Published:  3/7/2010
Code:  vstipEdit0025


Line numbers are not on by default.  To turn on line numbers just go to Tools -> Options -> Text Editor -> All Languages -> General -> Display and check Line numbers:


Comments (21)

  1. none says:

    Nice tip – way easier than looking at the bottom of the window for the line number

  2. Catto says:

    Hey Now Zain,

    This is a good one & I’ve enjoyed your series keep going.

    Thx 4 the info,


  3. Levi says:

    Tools -> Options -> Text Editor -> ALL LANGUAGES -> General -> Display and check Line numbers

  4. zainnab says:

    @Levi  that's the path in my post.  So…

  5. Gabriel the Greek says:

    Love your tips Zain. I read them everyday 🙂

    a little tip for you and your readers:

    – There is a macro to turn on Line numbers, and a macro to turn off line numbers.

    I've added both macros as buttons to the main tool bar (click small arrow in toolbar to ADD macro as a button).

    The macros are called   "Samples.Utilities.TurnOnLineNumbers" and "Samples.Utilities.TurnOffLineNumbers"

    Now, when I need extra space to view code, I can turn off or on line numbers at will.

    * Zain how do I assign a shortcut key to this?  And what shortcut key combination do you suggest to not interrupt VS2010 or other standard windows shortcuts?



    p.s. I wasted too much time trying to figure how to do this. I hope it becomes a standard button in the future 🙂

  6. zainnab says:

    @Gabriel — great point!  thanks for mentioning the macros.  to assign shorcut keys to macros check out blogs.msdn.com/…/create-a-shortcut-key-for-a-macro-vstiptool0066.aspx

  7. Gabriel says:

    Thanks Zain, great post.

    Looks like you ALREADY talked about the "turn on line numbers" macros before … wow … I guess I missed that one.

    Thanks 🙂


  8. zainnab says:

    @gabriel  Thanks man! 🙂  The funny part was I forgot that was the macro I had used when I did that tip.  I think I've been doing this too long 😛

  9. Gabriel says:

    You're better then you think Zain !    subconsciously you knew exactly where to send me  🙂  Thanks !

    Can you create a VS Tip of the day tutorial that accomplishes the following:

    1. Make a button on the toolbar that combines both macros. (One press turns on line numbers,  and the second press turns off)

    2. Show us how to add a graphic Icon to the button, to make it look professional

    3. Give an MSDN Ultimate subscription to the person who suggested such an interesting Tip of the day 🙂



  10. Gavin says:

    Levi is right, the path in the post is incorrect, you have missed out ALL LANGUAGES from it

  11. Bipin says:

    very useful to

    how to number editer in visual studio

    thanks alltem

  12. Vaibhav says:

    Is this facility is available in Embedded Visual C++ 4.0? If no then how to set line number in my coding?

  13. zainnab says:


    I did some looking but couldn't find an answer to your question.  Almost all IDE's have a way to view line numbers so I suspect there is a way but I am not familiar enough with the embedded C++ 4.0 IDE to know how.  


  14. Jospeh Amal raj.A says:

    in VS 2010 selecect "Show all settings" Optin button then only the TextEditor shows the languages other wise it shows General,File Extension only.

  15. Steff says:

    Many thanks. this helps so much in this world of insanity!

  16. John says:

    When I attempt to turn this setting on and subsequently click OK on the options window, Visual Studio crashes. Brilliant..

  17. sivasankar says:

    Thanks a lot.. useful info in quick second

  18. Proff says:

    i got the help I need nice help tool

  19. k l chowdary says:

    tq..for providing this information. keep updating all…

  20. Subir says:

    Thankyou this is so helpful for me.. nice tip

Skip to main content