473,810 Members | 3,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 FullNameOfThisF unction = ???
msgbox(FullName OfThisFunction )

end sub

-P

Oct 17 '06 #1
5 1689
pa***********@l ibero.it wrote:
How do I get the full name of the current (overload) function or sub
(whatever it be) ?
Imports System.Reflecti on

Dim mb as MethodBase _
= MethodBase.GetC urrentMethod()

? mb. ...

HTH,
Phill W.
Oct 17 '06 #2

Phill W. ha scritto:
>
Dim mb as MethodBase _
= MethodBase.GetC urrentMethod()
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 FullNameOfCalle rSub = ?????
msgbox(FullName OfCallerSub)
end sub

Oct 17 '06 #3
<pa***********@ libero.itschrie b:
How do I get the full name of the current (overload) function or sub
(whatever it be) ?

Sub SomeFunction()

Dim FullNameOfThisF unction = ???
msgbox(FullName OfThisFunction )
'MethodBase.Get CurrentMethod() .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.Diagnost ics.StackTrace &
System.Diagnost ics.StackFrame classes.

Dim trace As New StackTrace()
Dim caller As StackFrame = trace.GetFrame( 1)
Debug.WriteLine (caller.GetMeth od(), "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.goo glegroups.com.. .
>
Phill W. ha scritto:
>>
Dim mb as MethodBase _
= MethodBase.GetC urrentMethod()

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 FullNameOfCalle rSub = ?????
msgbox(FullName OfCallerSub)
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.Diagnost ics.StackTrace &
System.Diagnost ics.StackFrame classes.

Dim trace As New StackTrace()
Dim caller As StackFrame = trace.GetFrame( 1)
Debug.WriteLine (caller.GetMeth od(), "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.goo glegroups.com.. .

Phill W. ha scritto:
>
Dim mb as MethodBase _
= MethodBase.GetC urrentMethod()
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 FullNameOfCalle rSub = ?????
msgbox(FullName OfCallerSub)
end sub
Oct 19 '06 #6

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

Similar topics

5
10835
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 from a form using the GET method) is automatically removed. I do not know of any keys for the Request.ServerVariables collection that do this, but cannot find any other objects/properties that would be appropriate. Any help would be appreciated....
4
8862
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 advance!!! SELECT AIM.AIMRETRIEVAL.AIMRETRIEVALID, AIM.AIMRETRIEVAL.DESCRIPTION, AIM.ARCHIVERETRIEVAL.ARCHIVERETRIEVALID, AIM.ARCHIVERETRIEVAL.STATUSID,
15
1995
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
13956
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 oledbconnection and dataAdapter and filling the DataSet (ds) I tried this: TextBox1.DataBindings.Add("text", ds.Tables.Item("MyFile"), "MyField") I then put the following code in the SAVE button click event:
8
8867
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
3029
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
2692
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 name based on the name of the VB6 application. A second choice would be a file name based on the # COM interface assembly. I have tried calling Assembly.GetCallingAssembly() but this fails when I use the VB6 client. Is there a way to get this...
4
2841
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 program works correctly when calling it like this : ./program file1 file2, and also with full paths, like this : ./program c:\dir\file1 c:\dir\file2 However, a most puzzling phenomenon occurs when I use the full path only for the first file, like...
65
5110
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 got errors of Failed to open file ./outdir/mytestout.txt. Below is the code: #include <stdio.h>
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9200
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.