این تایید میشه ولی اگر کامپوننت به صورت ویژوال هست و میخوای روی فرم اضافه کنی بهتره که روی Toolbox کلیک راست کنی و بعد Choose Item رو انتخاب کنی. حال تو این پنجره ای که باز میشه، اگر نوع کامپوننتت دات نت هست باید تو همون Tab اول از لیست انتخابش کنی و یا با Browse اضافه کنی و اگر هم که از نوع COM هست از تب دوم به همون شکل.به نقل از H_R :با خود vs.net هم میتونی وارد برنامت کنی و راحت باهاش کار کنی ، توی سولوشن روی به عنوان یک رفرنس جدید میتونی معرفیش کنی ، رو قسمت رفرنس ها رایت کلیک کن تا ببنی چی میگم .
Public Class SampleClass
Public Shared Function SmapleFunc(ByVal arg As Integer) As Integer
Return arg + 1
End Function
End Class
Dim mAssembly As System.Reflection.Assembly
mAssembly = Reflection.Assembly.LoadFrom("C:\Sample.dll")
Dim scriptType As Type
Dim instance As Object
Dim rslt As Object
Try
'Get the type from the assembly. This will allow us access to
'all the properties and methods.
scriptType = mAssembly.GetType("Sample.SampleClass")
'instance = mAssembly.CreateInstance("SampleClass")
'Set up an array of objects to pass as arguments.
Dim args() As Object = {1}
'And call the static function
rslt = scriptType.InvokeMember("SampleFunc", _
System.Reflection.BindingFlags.InvokeMethod Or _
System.Reflection.BindingFlags.Public Or _
System.Reflection.BindingFlags.Static, _
Nothing, Nothing, args)
'Return value is an object, cast it back to a string and display
If Not rslt Is Nothing Then
MessageBox.Show(CType(rslt, String))
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try