Program Name and Line Number

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alex Campos

    #1

    Program Name and Line Number

    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.




  • Jeff B.

    #2
    Re: Program Name and Line Number

    > Using vb.net - how can I find the current program name and line number as
    I[color=blue]
    > am running through the code without there being an error.[/color]

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

    --
    Thanks, Jeff


    Comment

    • Bennie Haelen

      #3
      Re: Program Name and Line Number

      Here you go... This is C#, but it translates very easy:

      StackTrace stackTrace = new StackTrace(Thre ad.CurrentThrea d, true);

      StackFrame frame = stackTrace.GetF rame(0);

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

      frame.GetFileNa me(), frame.GetFileLi neNumber());



      Regards,



      Bennie Haelen

      "Alex Campos" <acampos@invali d.pcgh.com> wrote in message
      news:OMjhVdD4DH A.2888@tk2msftn gp13.phx.gbl...[color=blue]
      > Using vb.net - how can I find the current program name and line number as[/color]
      I[color=blue]
      > am running through the code without there being an error.
      >
      >
      >
      >[/color]


      Comment

      Working...