A Alex Campos Jan 21, 2004 #1 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.
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.
J Jeff B. Jan 21, 2004 #2 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. Click to expand... 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.
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. Click to expand... 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.
B Bennie Haelen Jan 23, 2004 #3 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
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