Wrox Programmer Forums
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 3rd, 2007, 05:13 PM
Authorized User
Join Date: Apr 2007
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Get Class from String?

Hi Gang,

I am trying to do something that I am pretty sure will work, but I cannot get over one hurdle...

I have a StringCollection of strings representing Classes. What I want to do is iterate over them, find the class each one names, and then invoke a shared function on that class.

I have been trying something like:
Dim bo As Type

bo = Type.GetType(stringName)
bo.invokeMember("sharedFunctionName", Reflection.BindingFlags.FlattenHierarchy, Nothing, Nothing, Nothing)
The problem with the code is the Type.GetType throws an error that it cannot find a class with the name I specify, which exists in the same project).

Secondly, if I overcome that hurdle, I do not understand the 4th param in the invokeMember function, which is the "target". Can someone please explain that to me? Isn't the target in this case bo, the object I am sending the invokeMember message to?



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to extend the String class hafizmuhammadmushtaq Java Basics 2 April 7th, 2008 06:21 AM
Invalid class string CH 6 itpro2 BOOK: Beginning ASP 3.0 0 May 22nd, 2006 05:15 PM
Invalid class string - : 0x800401F3 not24 C# 2005 1 March 16th, 2006 04:53 PM
Adding functionality to the String class? RobMeade BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 5 February 9th, 2005 02:11 PM
String class dotnetprogrammer VS.NET 2002/2003 0 November 20th, 2004 01:30 AM

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