O
Ohad weiss
Hi all,
I have a class in project A.
At the same solution, I have another project - named project B.
I want to write a piece of code in that class from project B that finds the
class in project A. How can I do that?
I have a code to do that, if the class is in the same project (by using
Application.ProductName, but even if I chaned it to the second project name,
its didn't work), and I've referenced it because I have some froms that I
inherited from project A..
:
Code:
Function GetFormByName(ByVal stFileName As String) As Form
Dim tFormType As Type = Type.GetType(stFileName, False)
If tFormType Is Nothing Then
Dim Fullname As String = Application.ProductName & "." &
stFileName
tFormType = Type.GetType(Fullname, False, True)
If tFormType Is Nothing Then
Throw New Exception(stFileName + " could not be found")
End If
End If
Return CType(Activator.CreateInstance(tFormType), Form)
End Function
Thanks
I have a class in project A.
At the same solution, I have another project - named project B.
I want to write a piece of code in that class from project B that finds the
class in project A. How can I do that?
I have a code to do that, if the class is in the same project (by using
Application.ProductName, but even if I chaned it to the second project name,
its didn't work), and I've referenced it because I have some froms that I
inherited from project A..
:
Code:
Function GetFormByName(ByVal stFileName As String) As Form
Dim tFormType As Type = Type.GetType(stFileName, False)
If tFormType Is Nothing Then
Dim Fullname As String = Application.ProductName & "." &
stFileName
tFormType = Type.GetType(Fullname, False, True)
If tFormType Is Nothing Then
Throw New Exception(stFileName + " could not be found")
End If
End If
Return CType(Activator.CreateInstance(tFormType), Form)
End Function
Thanks