Find the Calling CLASS name !! , class , event , csharp , 2.0 Milan, Italy
  • 7 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!!

  • 7 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.

“Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves” - Alan Kay