Turn on Line Numbers

Tips Search

Turn on Line Numbers

  • Comments 19

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:

image

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

  • Hey Now Zain,

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

    Thx 4 the info,

    Catto

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

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

  • 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?

    Thanks,

    Gabriel

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

  • @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

  • 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 :)

    Gabriel

  • @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 :P

  • 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 :)

    Thanks,

    Gabriel

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

  • fixed :)

  • very useful to

    how to number editer in visual studio

    thanks alltem

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

  • Vaibhav,

    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.  

    Z

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

Page 1 of 2 (19 items) 12
Leave a Comment
  • Please add 8 and 3 and type the answer here:
  • Post