Method name

Phylum

Centurion
Joined
Jun 20, 2003
Messages
105
Location
Canada
Is there a way for an routine to get its method name, class name, assembly name, etc.

For example:

Visual Basic:
Public Class Form1

   Public Sub MyName()
      
      'Code to return names into a msgbox

   End Sub

End Class

The result would be a msgbox with the following info:
Method : MyName
Class : Form1
Assembly: WindowsApplication1.exe
 
Phylum,

You can use this code to solve first part of your task:

Dim strProcName As String
Dim strClassName As String
Dim strAssName As String
strAssName = System.IO.Path.GetFileName( _
System.Reflection.Assembly.GetExecutingAssembly().Location())
strProcName = System.Reflection.MethodBase.GetCurrentMethod().Name
strClassName = Me.GetType().ToString


HTH,
Shamil
 
Back
Top