Solved

GetType

Posted on 2007-03-22
4
268 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

622 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