473,320 Members | 2,003 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,320 software developers and data experts.

Know the caller from within function...

Hi,

Is there a way to programmatically find out the caller of your function? For
example, let's say I have a function called MyFunction(), and I want to
debug print the caller of this function from within this function.

Private Sub MyFunction
// debug print the name of the caller
End Sub

What I actually want to accomplish by this is, I have a routine that handles
multiple events of a control, as shown below.

Private Sub Button1_Clicks(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click, Button1.DoubleClick

End Sub

I need to know, for which event the handler is being called.

Appreciate any inputs!

thanks!
-Yasutaka

Jul 21 '05 #1
1 1804
Take a look Environment.StackTrace

Nick

----- Yasutaka Ito wrote: ----

Hi

Is there a way to programmatically find out the caller of your function? Fo
example, let's say I have a function called MyFunction(), and I want t
debug print the caller of this function from within this function

Private Sub MyFunctio
// debug print the name of the calle
End Su

What I actually want to accomplish by this is, I have a routine that handle
multiple events of a control, as shown below

Private Sub Button1_Clicks(ByVal sender As System.Object, ByVal e A
System.EventArgs) Handles Button1.Click, Button1.DoubleClic

End Su

I need to know, for which event the handler is being called

Appreciate any inputs

thanks
-Yasutak
Jul 21 '05 #2

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

Similar topics

2
by: David Abrahams | last post by:
Is there any way to determine the file and line number (if any) of a method's invocation from within its body? Many Thanks in advance, Dave -- David Abrahams Boost Consulting...
2
by: Mark | last post by:
The situtation is that I'm trying to ensure that certain functions are only called by functions that I want them to be called from. I have a popup window which has a function which calls a function...
0
by: Yasutaka Ito | last post by:
Hi, Is there a way to programmatically find out the caller of your function? For example, let's say I have a function called MyFunction(), and I want to debug print the caller of this function...
4
by: Thomas Mlynarczyk | last post by:
Hi, I stumbled over a strange behaviour of Mozilla. When I want to access the caller property of a function that was not called from within another function, Mozilla seems to abort the script....
20
by: 2pac | last post by:
in this scenario foo1 ---calls---> foo2 is it possible for me to print out - when the control is within foo2 - the caller of foo2 the information is obviously there in the stack - am wondering...
1
by: jg | last post by:
I have searched marshaling articles from MSDN and Google but I am stuck with solving my problem to marshal arrays to COM caller from my managed COM class I built a .net COM class in VB and...
9
by: Csaba Gabor | last post by:
Inside a function, I'd like to know the call stack. By this I mean that I'd like to know the function that called this one, that one's caller and so on. So I thought to do: <script...
9
by: billiejoex | last post by:
Hi there, unfortunately, I'm compelled to apply a sort of monkey patching at the code of an existing libreary that I can't modify directly. Here's my question Having such code: class test: ...
9
by: Erwin Moller | last post by:
Hi all, Is it possible (PHP5.2) to find the name of a variable used in the caller of a function from within the function itself? Or to be more clear: ...php code.. $result = foo($abc);...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.