Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Full qual. name of current method

34 views
Skip to first unread message

pamela...@libero.it

unread,
Oct 17, 2006, 8:26:41 AM10/17/06
to

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

Phill W.

unread,
Oct 17, 2006, 9:12:48 AM10/17/06
to
pamela...@libero.it wrote:

> 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.

pamela...@libero.it

unread,
Oct 17, 2006, 10:08:46 AM10/17/06
to

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

Herfried K. Wagner [MVP]

unread,
Oct 17, 2006, 11:20:03 AM10/17/06
to
<pamela...@libero.it> schrieb:

'MethodBase.GetCurrentMethod().Name'

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jay B. Harlow

unread,
Oct 18, 2006, 9:19:11 AM10/18/06
to
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")


--
Hope this helps
Jay B. Harlow
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


<pamela...@libero.it> wrote in message
news:1161094126.5...@b28g2000cwb.googlegroups.com...

pamela...@libero.it

unread,
Oct 19, 2006, 12:52:16 PM10/19/06
to

Jay B. Harlow ha scritto:

> 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")
>
>
> --
> Hope this helps

Thanks very helpful.

Thanks to all.

0 new messages