Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 16th, 2005, 01:16 AM
Registered User
Join Date: Jul 2004
Location: Bangalore, Karnataka, India.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Srikanth_nd Send a message via Yahoo to Srikanth_nd
Default CreateInstance method problem(urgent)..

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


'Here append the class name with the component name.

Dim sbTypeName As StringBuilder = New StringBuilder("")




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.CreateComponentIns tance("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


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call DLL Method in Javascritp? URGENT!!!!!! prabhakar123 Javascript 26 November 28th, 2011 07:06 AM
Urgent Help Needed : InvalidateControl Method vikasbhandari2 .NET Framework 3.5 0 June 11th, 2008 09:38 AM
Problem with Activator.CreateInstance karveajit .NET Framework 1.x 0 May 11th, 2006 01:05 AM
Stackoverflow error in recursive method (URGENT... sangi Java Espanol 0 March 27th, 2005 05:53 AM
getrows method-urgent????? mikedeepak Classic ASP Databases 6 September 1st, 2004 03:36 AM

All times are GMT -4. The time now is 02:32 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.