Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding sequential line numbers to program code 1

Status
Not open for further replies.

Mike Lewis

Programmer
Jan 10, 2003
17,509
Scotland
When you want to explain a big chunk of code to someone, it's often helpful to add line numbers. The number don't form part of the executable code, of course, but they can be useful for pointing out particular lines.

You can see an example in thread184-1819595, in the post date-stamped "2 Dec 22 15:16". Here, I added line numbers so that I could point out particular difficulties with certain lines of code.

I've always wished that VFP had an automatic way of doing this. (If anyone knows of one, please post it here.) However, it's fairly easy to do in Notepad++ (and no doubt in other programmers' editors).

1. Select a zero-width column at the left edge of the code. To select a column, hold down the Alt key while you drag the mouse downward.

2. Go to Edit -> Column Editor.

3. In the resulting dialogue, select "Number to insert", and set the starting number and increment to 1 (or whatever other values you like).

If you find that selecting a zero-width column is tricky, you can indent each line and use the resulting white space as your column.

I hope this might be useful to some of you.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top