473,396 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Showing Line numbers in code

The following shows me the last line number executed. It requires an error.

7811: Try
Err.Raise(60000)
Catch ex As Exception
MsgBox("Error 60000 at " & Err.Erl())
End Try

Is there a way to show a line number without creating an error. For
example, I am looking for a function that would return the following message:

"You just executed a statement at line #7811"

7811: If X = 2 Then
MsgBox "You just executed a statement at #" & ????
End IF

I can't find this function or figure out how to write it. Is there a way to
do this?
Nov 21 '05 #1
2 2123
"genojoe" <ge*****@discussions.microsoft.com> schrieb:
"You just executed a statement at line #7811"

7811: If X = 2 Then
MsgBox "You just executed a statement at #" & ????
End IF

I can't find this function or figure out how to write it. Is there a way
to
do this?


AFAIK, no.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2
If you are using the Debug version (that is, you generate a .pdb file) the
closest that I can think is:

Dim objStackFrame As StackFrame
Dim x As Integer

If x = 0 Then
objStackFrame = New StackFrame(True)
MessageBox.Show("You have executed line " &
(objStackFrame.GetFileLineNumber() - 1).ToString)
End If

And then you can display line numbers in the code using the Tools, Options
menu, Text Editor, Basic, General node, Display Line Numbers checkbox.

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
"genojoe" <ge*****@discussions.microsoft.com> escribió en el mensaje
news:79**********************************@microsof t.com...
The following shows me the last line number executed. It requires an
error.

7811: Try
Err.Raise(60000)
Catch ex As Exception
MsgBox("Error 60000 at " & Err.Erl())
End Try

Is there a way to show a line number without creating an error. For
example, I am looking for a function that would return the following
message:

"You just executed a statement at line #7811"

7811: If X = 2 Then
MsgBox "You just executed a statement at #" & ????
End IF

I can't find this function or figure out how to write it. Is there a way
to
do this?

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: drew | last post by:
I am reading my textbook and doing the code examples in MS Visual C++ 6.0 for my next class beginning Jan 05. The textbook examples show line numbers. How do I get line numbers to show as I type in...
2
by: kak3012 | last post by:
Hi, I have a text file I will read it and write out binary. The file includes 256 coloums. I use while (infile.good()) { infile.getline (buffer,2200);
14
by: beginner10 | last post by:
How can i changhe this code showing how many persons i saved to the file? And it prints pretty much rubbish. Where is the problem? #include <stdio.h> int main() { int i; FILE *data_file;...
8
by: Arun Bhalla | last post by:
Hi, I'm developing an Explorer bar using VS.NET 2003 (C#) on Windows XP. For some time, I've noticed that I don't have filenames and line numbers appearing in my exceptions' stack traces. On...
3
by: Jim Bancroft | last post by:
Hi all, In VB6 I used a 3rd party tool for line numbering my source code, to help with debugging. However, in experimenting with VB .Net I've noticed that my exceptions automatically provide...
2
by: Ben | last post by:
Hello all After years of playing developing stuff for fun and personal use I'm finally developing an app that I am intending to sell. As such, I'm trying to make it as reliable and stable as...
4
by: J L | last post by:
Are there any free add-ins for VB.Net that will add and remove line numbers from the source code? TIA John
4
by: TS | last post by:
I have an application on one server that shows line numbers in stack trace, but on another server the "in c:\xxx.aspx:line 9999" part that accompanies the "at" part doesn't show. Besides this...
1
by: bluclouds9 | last post by:
I am new to Access and have been charged with creating a database for our course alumni. I currently have a "Contacts" form and am trying to create a subform to hold the course alumni...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.