|
-
Nov 3rd, 2002, 09:51 AM
#1
Thread Starter
PowerPoster
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.
-
Nov 3rd, 2002, 10:19 AM
#2
Fanatic Member
Not that I know of. What you have to do is number each line yourself. For example:
VB Code:
Private Sub Command1_Click()
1 HelloWorld
End Sub
Private Sub HelloWorld()
2 Dim a As String
3 Dim b As String
4 a = "Hello"
5 b = "World"
6 MsgBox a & " " & b
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
-
Nov 3rd, 2002, 10:21 AM
#3
-
Nov 3rd, 2002, 10:24 AM
#4
Fanatic Member
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
-
Nov 3rd, 2002, 10:29 AM
#5
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.
-
Nov 3rd, 2002, 10:47 AM
#6
Thread Starter
PowerPoster
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"
-
Nov 3rd, 2002, 10:51 AM
#7
Oh, in that case you and your co-developer want to install and use NetMeeting. It lets you both look at the same window and he can see where your mouse is pointing.
-
Nov 3rd, 2002, 10:58 AM
#8
Thread Starter
PowerPoster
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 ...
-
Nov 3rd, 2002, 11:19 AM
#9
PowerPoster
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....
-
Nov 3rd, 2002, 11:21 AM
#10
PowerPoster
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Nov 3rd, 2002, 11:29 AM
#11
Thread Starter
PowerPoster
Thanks James,
That looks interesting ... Ill check it out.
-
Nov 3rd, 2002, 11:30 AM
#12
PowerPoster
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Nov 3rd, 2002, 11:53 AM
#13
Fanatic Member
Martin:
Line numbering can be used for other err coding beside the "GoTo" statement. I use it as follows.
VB Code:
Private Sub Command1_Click()
1 HelloWorld
End Sub
Private Sub HelloWorld()
9 On Error GoTo ErrCode
2 Dim a As String
3 Dim b As String
7 Dim c As Integer
4 a = "Hello"
5 b = "World"
8 c = "String"
6 MsgBox a & " " & b
Exit Sub
ErrCode:
MsgBox Err.Number & vbCrLf & Erl & vbCrLf & Err.Description
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
-
Nov 3rd, 2002, 12:06 PM
#14
...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.
-
Nov 3rd, 2002, 12:27 PM
#15
Thread Starter
PowerPoster
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.
-
Nov 3rd, 2002, 01:31 PM
#16
Sure. If you have the Standard toolbar showing, you'll see something like the following if you are editing code.
Ln 31, Col 7
-
Nov 3rd, 2002, 02:00 PM
#17
Thread Starter
PowerPoster
doh!
cant believe i never saw that ...
Thanks!
-
Jul 22nd, 2016, 07:59 AM
#18
Junior Member
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.
-
Jul 22nd, 2016, 09:54 AM
#19
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|