English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

the question is i am having one object it has lot of methods and properties,events,data members and inherited members of another class.
i have to refer that object using string
how can i do it

Ex:

dim obj as new object

set ob=......

dim str as string

str="obj"

str. here i want to get all members using str

2006-09-04 22:27:25 · 2 answers · asked by Kalimuthu 1 in Computers & Internet Software

2 answers

If you are needing to create an instance of a class based upon the string name of the class you would need to use Reflection in .NET.

Dim typeDyn As Type
typeDyn = Type.GetType("TheTypeNameGoesHere")

Dim objInstance As MyBaseClass
objInstance = Activator.CreateInstance(t)

objInstance.ObjectMethod();

2006-09-04 22:43:35 · answer #1 · answered by aa7im 2 · 0 0

Kalimuthu Find out for yourself here is the link

http://www.google.co.uk/search?hl=en&q=convert+string+to+object+vb6.0+or+.Net&btnG=Search&meta=

2006-09-05 05:52:20 · answer #2 · answered by Joe_Young 6 · 0 0

fedest.com, questions and answers