-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: brainatwork_av
Message 1 in Discussion
hi friends, i got stuck with a problem. in my component i have
one method which will create an instance of the componentname and class we
passed. code is here:
Public Function CreateComponentInstance(ByVal strComponentName As String, ByVal
strclassName As String) As Object
Try
'Here append the class name with the component name.
Dim sbTypeName As StringBuilder = New StringBuilder("")
sbTypeName.Append(strComponentName)
sbTypeName.Append(".")
sbTypeName.Append(strclassName)
Dim sTypeName As String = sbTypeName.ToString()
'Load the Assembly and get the Type of it.
Dim objAssembly As System.Reflection.Assembly =
System.Reflection.Assembly.Load(strComponentName)
Dim objType As Type = objAssembly.GetType(sTypeName)
'Pass the type to the method and get the instance.
Dim objReturn As Object = System.Activator.CreateInstance(objType)
Return objReturn
Catch ex As Exception
Throw New Exception(String.Format("Component Error", ex.Message))
End Try
End Function
while testing this method i am getting an error. i created a class file with
assembly name as testApp. and class name as testApp. then i gave the strong
name for the assembly and registered in the GAC. after that i refered that
component in my test web app.
then i tried to call my method like this
using testApp;
testApp.testApp otestApp =
(testApp.testApp)mycomponentObj.CreateComponentInstance("testApp","testApp");
i am getting an error saying file or assembly name testApp, or one of its
dependencies was not found.
can any one help me out to solve the problem?...
thanks in advance
Rashid
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]