Vb.net 2008 detect current sub name

Posted on 2009-02-24
Medium Priority
Last Modified: 2013-11-26
i need to write an event log. how to know what is the current sub routine name??
Question by:aarontham
  • 2
LVL 53

Expert Comment

ID: 23721448
You can use Reflection:

LVL 53

Accepted Solution

Dhaest earned 2000 total points
ID: 23721453
System.Reflection.MethodBase.GetCurrentMethod().Name yields current method name.

System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.FullName yields fullyqualified name of the method's class

System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.Name yields method's class name without Namespace

System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.Namespace yield namespace
LVL 19

Expert Comment

ID: 23721512

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Integration Management Part 2
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

840 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