Results 1 to 19 of 19

Thread: VB6 source line numbers [RESOLVED]

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046

    VB6 source line numbers [RESOLVED]

    is there any way to get the VB6 IDE to show line numbers ?
    Last edited by Muddy; Nov 3rd, 2002 at 02:03 PM.

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    Not that I know of. What you have to do is number each line yourself. For example:

    VB Code:
    1. Private Sub Command1_Click()
    2. 1 HelloWorld
    3. End Sub
    4.  
    5. Private Sub HelloWorld()
    6. 2 Dim a As String
    7. 3 Dim b As String
    8. 4 a = "Hello"
    9. 5 b = "World"
    10. 6 MsgBox a & " " & b
    11. End Sub

    If you search around, I'm sure that somebody has developed an addin for the VB IDE to do this for you, but I don't know of a specific one. You might try www.searchvb.com as a start.
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

  3. #3

  4. #4
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    I would assume he wants them for Error Coding. They're not good for much else.
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    In my opinion they are not good for anything. Not only is GoTo 87 (and similar) a recipe for spaghetti code, but imagine the maintenance nightmare when adding and removing lines of code between the GoTo and line 87.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    not for coding purposes.

    its just that i when i am doing some debugging on the phone with a co-developer i constantly find myself saying things like:

    "Look at strSQL in module A , sub B ... no not that one, the third one down from that ... blah blah"

    Itd just be easier to say "Look at line 244 in module A"

  7. #7

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    yah netmeeting is good, but id still like to be able talk effectively about code without having a network connection handy on both ends.

    Thanks for the responses, btw ...

  9. #9
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    There is an addin "PrettyCode" something or other which allows you to print with line numbers, but nothing I have seen for within VB IDE.
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  10. #10
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    look HERE
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  11. #11

    Thread Starter
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    Thanks James,

    That looks interesting ... Ill check it out.

  12. #12
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  13. #13
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    Martin:
    Line numbering can be used for other err coding beside the "GoTo" statement. I use it as follows.

    VB Code:
    1. Private Sub Command1_Click()
    2. 1 HelloWorld
    3. End Sub
    4.  
    5. Private Sub HelloWorld()
    6. 9 On Error GoTo ErrCode
    7. 2 Dim a As String
    8. 3 Dim b As String
    9. 7 Dim c As Integer
    10. 4 a = "Hello"
    11. 5 b = "World"
    12. 8 c = "String"
    13. 6 MsgBox a & " " & b
    14. Exit Sub
    15. ErrCode:
    16. MsgBox Err.Number & vbCrLf & Erl & vbCrLf & Err.Description
    17. End Sub

    "Erl" will return the line number that generated the error. Also you said:

    "but imagine the maintenance nightmare when adding and removing lines of code between the GoTo and line 87."

    If you look at the above example, you do not have to re-number when you add or delete code. VB does not care if the line numbers are in order. Plus if you seperate your code into multiple subs and number the subs individualy, you can better keep track of your numbering. Just be sure that your error coding tells the user what sub the error occured in.
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

  14. #14
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    ...you can better keep track of your numbering.
    I think that says it all. Sure, putting line numbers on every line of code makes it a little easier to locate the line that is causing the problem, but in the real world programs have thousands (if not tens of thousands) of lines and I can't imagine using line numbers in that case.

  15. #15

    Thread Starter
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    Actually I was thinking of something more along the lines of the cursor position information in MSFT Word (ie Ln11). Does this exist in the IDE anywhere?

    I really dont want to number thousands of lines of code even if I can find an add in to do it for me.

  16. #16

  17. #17

    Thread Starter
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    doh!

    cant believe i never saw that ...



    Thanks!

  18. #18
    Junior Member
    Join Date
    Nov 2015
    Posts
    31

    Re: VB6 source line numbers [RESOLVED]

    (Yes this is an old post. But it's one of the first to come up in Google when looking for information about this topic.)
    Last edited by Shaggy Hiker; Jul 22nd, 2016 at 09:53 AM.

  19. #19
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,110

    Re: VB6 source line numbers [RESOLVED]

    It IS an old thread, and should be left as such. Advertising a commercial tool is not allowed, and since the tool you had mentioned no longer has a free version, I have removed it from the thread.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width