?
Solved

Determining the class that called the function

Posted on 2005-04-06
1
Medium Priority
?
196 Views
Last Modified: 2010-04-23
Hi

I have a function in a module and multiple classes. Is there any way to determine which class called the function within the function, without passing any variables.

Thanks
Adam
0
Comment
Question by:adam_pedley
1 Comment
 
LVL 19

Accepted Solution

by:
arif_eqbal earned 2000 total points
ID: 13724012
Hi Adam
you can do that
You need to check the StackTrace

here goes...

        Dim strace As New StackTrace
        Dim frame As New StackFrame
        frame = strace.GetFrame(1)
        MsgBox("Calling Function" & frame.GetMethod().Name)

Frame 0 gives the uppermost fn in the Trace which will be this fn itself, 1 gives the next fn, which will be the calling fn.
so frame = strace.GetFrame(1)

hope that's what you want
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question