How to know when lines are a certain length in Visual Studio

There are many reasons why you would want to know when a line in the code editor in Visual Studio is a certain length.  For me, it has to do with authoring books where the publisher needs to have a CRLF at a certain line size. 

I found this page with a handy tip on how to edit the registry to create a visual guide at a certain character width.  To set a visual guide at 84 and 100 characters in Visual Studio 2008, open a .NET command prompt and run this command:

C:\Windows\system32>REG ADD "HKCU\Software\Microsoft\VisualStudio\9.0\Text Editor" /v Guides /d "RGB(128,0,0) 83, 99

It puts a guideline such that the last character (highlighted in this screenshot) is character 84. (The setting must be zero based :-))


You have to close and then re-open Visual Studio for the change to take affect.

Skip to main content