By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,955 Members | 1,768 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,955 IT Pros & Developers. It's quick & easy.

Program Name and Line Number

P: n/a
Using vb.net - how can I find the current program name and line number as I
am running through the code without there being an error.


Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
> Using vb.net - how can I find the current program name and line number as
I
am running through the code without there being an error.


Take a look at the "System.Diagnostics.StackFrame" class. It should give
you what you're looking for so long as you're running in "debug" mode.

--
Thanks, Jeff
Jul 21 '05 #2

P: n/a
Here you go... This is C#, but it translates very easy:

StackTrace stackTrace = new StackTrace(Thread.CurrentThread, true);

StackFrame frame = stackTrace.GetFrame(0);

Console.WriteLine("File Name: {0}, Line Number: {1}",

frame.GetFileName(), frame.GetFileLineNumber());

Regards,

Bennie Haelen

"Alex Campos" <ac*****@invalid.pcgh.com> wrote in message
news:OM**************@tk2msftngp13.phx.gbl...
Using vb.net - how can I find the current program name and line number as I am running through the code without there being an error.

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.