0

Dear Experts.
I have a DLL , written in VB.Net.
This DLL has a below Function:

Public Shared Function CreateApplication(ByVal aobj As Object) As Object

When i Try to call this function by exe application with below routin i get "Parameters count mismach" Error.

Public Function loadDllAndRunMethod(ByVal dllFilePath As String, ByVal className As String, ByVal methodName As String) As Object
        Dim params(1) As Object
        params(0) = Nothing
        Dim asm As Assembly = Assembly.LoadFile(dllFilePath)
        For Each t As Type In asm.GetTypes()
            If (t.Name.EndsWith(className)) Then
                Dim method As MethodInfo = t.GetMethod(methodName)
                Return method.Invoke(Nothing, params(0))                Exit For
            End If
        Next

    End Function

What was wrong.
any solution available?

Edited by __avd: Added [code] tags.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by __avd
0

VB.NET uses upperbound not a size to create an array. Dim params(1) as Object will create two variables of an Object type.

Dim params(0) As Object
 params(0) = Nothing
 ..
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.