Know who is calling your Visual Basic code at runtime
2010-12-18 04:20:20
The other day I found what I think is the easiest way to know who is calling a Visual Basic Dot Net method in your code at run time.
Sub Caller()
Call Callee()
End Sub
Sub Callee()
Dim trace As New StackTrace(True)
Console.WriteLine(trace.GetFrame(1).GetMethod.Name )
' Writes "Caller" to the console window
End Sub
It strikes me as is incredibly similar to the way you do it in Java.