Solved

Is there a way to determine all of a class's methods?

Posted on 2004-11-01
173 Views
Last Modified: 2010-04-23
I have a drop down box I would like to populate with the names of all methods in a public class. Is there a way to loop through a class's methods?
0
Question by:BASESLydia
    3 Comments
     
    LVL 69

    Expert Comment

    by:Éric Moreau
    A hint: You need to use Reflection.
    0
     
    LVL 4

    Accepted Solution

    by:
    Hi !
    Try this :

            Dim ObjectType As Type = GetType(**THE NAME OF YOUR CLASS **)
            Dim MI As Reflection.MethodInfo
            For Each MI In ObjectType.GetMethods()
                If MI.IsPublic Then
                    CmbMethods.Items.Add(MI.Name)
                End If
            Next

    Glom
    0
     
    LVL 1

    Author Comment

    by:BASESLydia
    Excellent! I appreacite the hint emoreau, but Glom's code works without me having to make any guesses!
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    This video discusses moving either the default database or any database to a new volume.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    846 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

    Need Help in Real-Time?

    Connect with top rated Experts

    3 Experts available now in Live!

    Get 1:1 Help Now