Listing Non-Visual Component Names at Runtime

Listing Non-Visual Component Names at Runtime

Post by d-barto » Wed, 10 Oct 2007 17:04:23


Hi,

I have a number of non-visual components which I am trying to get the
name of at run time.

I have managed to reference each component using the following:

Dim pf As Type

pf = f.GetType
Dim fi As FieldInfo = pf.GetField("components",
BindingFlags.Instance Or BindingFlags.NonPublic)
' Dim o As Object =
Dim cl As IContainer = CType(fi.GetValue(f), IContainer)
Dim cm As Component

For Each cm In cl.Components
... etc

The cm.name gives me the type name of the object whereas I need the
actual name that the uer entered.

Am I going about this the correct way, is it possible to get this
info?

Thanks in advance
 
 
 

Listing Non-Visual Component Names at Runtime

Post by Q3JhaW » Thu, 27 Dec 2007 04:07:00

Did you find an answer to your question? I too need the Component name at
runtime and I don't see it with reflection. Please help.

Thanks!