Solved

GetType

Posted on 2007-03-22
4
260 Views
Last Modified: 2012-05-05
Hello experts,

I am trying to populate a combo with a list of public functions like this:

For Each o In m_RuleMgr.GetType.GetMethods()
            If Not o.IsHideBySig Then
                cmboPublic.Items.Add(o.name.toupper)
            End If
        Next

What I'd like to add to :
 cmboPublic.Items.Add(o.name.toupper)

are the argument names of the functions. How can I accomplish this?
0
Comment
Question by:thenrich
  • 2
  • 2
4 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
Seems like you've got it mostly figured out...what is the question?

Public Class Form1

    Private Class RuleMgr
        Public Function MethodA() As String
            Return ""
        End Function
        Public Function MethodB() As String
            Return ""
        End Function
        Public Function MethodC() As String
            Return ""
        End Function
    End Class

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim m_RuleMgr As New RuleMgr
        For Each o As System.Reflection.MethodInfo In m_RuleMgr.GetType.GetMethods()
            If Not o.IsHideBySig Then
                ComboBox1.Items.Add(o.Name.ToUpper)
            End If
        Next
    End Sub

End Class
0
 
LVL 5

Author Comment

by:thenrich
Comment Utility
some of my functions are like this:

Private Class RuleMgr
        Public Function MethodA(dim Description as String) As String
            Return ""
        End Function
End Class

I want to capture the "Description" parameter as well. Nothing fancy I just want to know it's there and the name description
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 250 total points
Comment Utility
Something like...

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim m_RuleMgr As New RuleMgr
        For Each o As System.Reflection.MethodInfo In m_RuleMgr.GetType.GetMethods()
            If Not o.IsHideBySig Then
                Debug.Print("Method: " & o.Name)
                For Each p As System.Reflection.ParameterInfo In o.GetParameters
                    Debug.Print("   Parameter: " & p.Name)
                    Debug.Print("        Type: " & p.ParameterType.ToString)
                Next
            End If
        Next
    End Sub
0
 
LVL 5

Author Comment

by:thenrich
Comment Utility
It's almost like having another developer on staff!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

11 Experts available now in Live!

Get 1:1 Help Now