|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Full qual. name of current methodHi 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 pamelaflue***@libero.it wrote:
> How do I get the full name of the current (overload) function or sub Imports System.Reflection> (whatever it be) ? Dim mb as MethodBase _ = MethodBase.GetCurrentMethod() ? mb. ... HTH, Phill W. Phill W. ha scritto:
> Thanks Phill . Very helpful.> Dim mb as MethodBase _ > = MethodBase.GetCurrentMethod() > 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 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") -- Show quoteHide quoteHope this helps Jay B. Harlow ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net <pamelaflue***@libero.it> wrote in message news:1161094126.501697.121150@b28g2000cwb.googlegroups.com... > > 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 > Jay B. Harlow ha scritto:
> Pamela, Thanks very helpful.> > 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 to all. Show quoteHide quote > Jay B. Harlow > .NET Application Architect, Enthusiast, & Evangelist > T.S. Bradley - http://www.tsbradley.net > > > <pamelaflue***@libero.it> wrote in message > news:1161094126.501697.121150@b28g2000cwb.googlegroups.com... > > > > 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 > > <pamelaflue***@libero.it> schrieb:
> How do I get the full name of the current (overload) function or sub 'MethodBase.GetCurrentMethod().Name'> (whatever it be) ? > > Sub SomeFunction() > > Dim FullNameOfThisFunction = ??? > msgbox(FullNameOfThisFunction ) -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
how do you use Class to hold global variables?
VB.NET Datagrid with pictures VB equivalent of this C# code What framework is running in this scenario? Writing Data In Tabular format in Text File. VBNET2005 : Manipulating MS Access tabledefinitions in VB.NET -> Create, Copy and Drop Table. Showing Form in New Thread? db connections and text boxes Arrow on a button control User controls in VS 2005 |
|||||||||||||||||||||||