473,397 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Full qual. name of current method


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

Oct 17 '06 #1
5 1671
pa***********@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.
Oct 17 '06 #2

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

Oct 17 '06 #3
<pa***********@libero.itschrieb:
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'

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Oct 17 '06 #4
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
<pa***********@libero.itwrote in message
news:11**********************@b28g2000cwb.googlegr oups.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
Oct 18 '06 #5

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.
Jay B. Harlow
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
<pa***********@libero.itwrote in message
news:11**********************@b28g2000cwb.googlegr oups.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
Oct 19 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Nathan Sokalski | last post by:
I need to get the full URL of the current page in ASP. When using Request.ServerVariables("URL") anything after the filename (such as a #section1 to jump to an area on the page or data submitted...
4
by: Anthony Robinson | last post by:
I was actually just wondering if someone could possibly take a look and tell me what I may be doing wrong in this query? I keep getting ambiguous column errors and have no idea why...? Thanks in...
15
by: Mark Kamoski | last post by:
Hi Everyone-- Please help. How can one get the name of the current project and the current class? This is the situation. Suppose there is a project called "P1".
6
by: JohnR | last post by:
I have a table with 1 row which is used to hold some application wide items (one item per field, hence I only need 1 row). I want to bind one of the fields to a textbox. After setting up the...
8
by: news.microsoft.com | last post by:
How do I get the class name for a current instance. For example, if I want to know the Class Name for the current form, how do I get this programatically. Thanks
4
by: somank.sharma | last post by:
I am running an exe created in C. I need the full path (absolute path) of this exe. In the first argument of main, I am getting the exe name. How can I get the full path for this exe.
7
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
4
by: Michel Rouzic | last post by:
I made a program that accepts as parameters an input file name that we'll call file1, and an output file name that we'll call file2, and opens on its own a configuration file called file3. My...
65
by: Hongyu | last post by:
Dear all: I am trying to write to a file with full directory name and file name specified (./outdir/mytestout.txt where . is the current directory) in C programming language and under Unix, but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.