Know the caller from within function...

  • Thread starter Thread starter Yasutaka Ito
  • Start date Start date
Y

Yasutaka Ito

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
 
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
 
Back
Top