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?

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
 ..
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.