Hi All :
I'm VB.Net Beginner I try to create object Dynamically :
In my testing, I create 2 .net project
One is MyApp (Type is windows application) with one button name "Button1"
The another one is "prj01" (Type is Class libary) with one public Class name
"dbLib"
In this prj01.dbLib I create the simple code "
Public Class dbLib
Public Function SendMsg()
MsgBox("a")
End Function
End Class
and success to compile.
In the MyApp.Form1 I create the following Simple code :
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim oCar As Object
Dim ty As Type = Type.GetType("prj01.dbLib")
oCar = Activator.CreateInstance(ty)
oCar.SendMsg()
End Sub
End Class
However , while I run the project , The object "ty" return NOTHING.
And show error "Value Cannot be Null"
How can fix it
Thanks