How to access assembly method or functions?


To access dll or assembly method in your page using VB.NET.

The code shows how to access the assembly, DLL Methods in your page. code created in VB.NET.

They are two ways to access

First Method




Dim objAssembly As [Assembly] = [Assembly].Load("SARF.BMS.PlugInCode.Web")
Dim oType As Type
' Display all the types contained in the specified assembly.
For Each oType In objAssembly.GetTypes()
If oType.Name.ToUpper = strPlugInClass.ToUpper() Then
Dim args() As Object = {Me}
objPlugIn = Activator.CreateInstance(oType, args)
Exit For
End If
Next oType


1. Assembly.Load Method used to load the DLL file using Assembly class
2. Get all the Types available using GetTypes
3. objPlugIn is instance of that class, objPlugIn contain all the methods


Second Method

Dim objValidationScript As Object = Assembly.Load("DLLClassLibrary").CreateInstance("DLLClassLibrary.Class1")
strScript = objValidationScript.test1("welcome")


CreateInstance("DLLClassLibrary.Class1") is create instance for the class1
bjValidationScript.test1 is method which written in class1 class


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: