Solved

GetType

Posted on 2007-03-22
4
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18772033
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
ID: 18772083
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 86

Accepted Solution

by:
Mike Tomlinson earned 250 total points
ID: 18772147
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
ID: 18772370
It's almost like having another developer on staff!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

733 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