Find the Calling CLASS name !! , class , event , csharp , 2.0 Milan, Italy
  • 11 years ago

    Hi ! I need to retrieve the Calling-Class-name...

    For example.. if I Have a code like this

    MyTest MyCallingClass= new MyTest(); 

    and I also have a class "MyTest" like this

        public class MyTest
           public string test_A()
             return   ??????????.ToString()

    In my page I Want to see "MyCallingClass" So.. How can I retrieve the name "MyCallingClass" from MyTest

    Thanx and sorry for my bad english!!

  • 11 years ago


    with something like that?

    Imports System.Reflection

    public sub bla

    txtMain.Text = MethodBase.GetCurrentMethod.ToString

    end sub

    Look at MethodBase.GetCurrentMethod.

    Greets, dh

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter” - Eric Raymond