Full qual. name of current method

  • Thread starter Thread starter pamelafluente
  • Start date Start date
P

pamelafluente

Hi guys,

How do I get the full name of the current (overload) function or sub
(whatever it be) ?

Sub SomeFunction()

Dim FullNameOfThisFunction = ???
msgbox(FullNameOfThisFunction )

end sub

-P
 
How do I get the full name of the current (overload) function or sub
(whatever it be) ?

Imports System.Reflection

Dim mb as MethodBase _
= MethodBase.GetCurrentMethod()

? mb. ...

HTH,
Phill W.
 
Phill W. ha scritto:
Dim mb as MethodBase _
= MethodBase.GetCurrentMethod()

Thanks Phill . Very helpful.
I would also need the name of the caller. Is it simple to get ?

Sub Caller
me.CalledBy()
end sub

Sub CalledBy()
Dim FullNameOfCallerSub = ?????
msgbox(FullNameOfCallerSub)
end sub
 
How do I get the full name of the current (overload) function or sub
(whatever it be) ?

Sub SomeFunction()

Dim FullNameOfThisFunction = ???
msgbox(FullNameOfThisFunction )

'MethodBase.GetCurrentMethod().Name'
 
Pamela,
I would also need the name of the caller. Is it simple to get ?
You can use the System.Diagnostics.StackTrace &
System.Diagnostics.StackFrame classes.

Dim trace As New StackTrace()
Dim caller As StackFrame = trace.GetFrame(1)
Debug.WriteLine(caller.GetMethod(), "caller")
 
Jay B. Harlow ha scritto:
Pamela,
You can use the System.Diagnostics.StackTrace &
System.Diagnostics.StackFrame classes.

Dim trace As New StackTrace()
Dim caller As StackFrame = trace.GetFrame(1)
Debug.WriteLine(caller.GetMethod(), "caller")

Thanks very helpful.



Thanks to all.
 
Back
Top