Hi Armin,
I have a 3rd party control and the parameters has to be given like this (for
ex.)
prp = ctl.AppendProperty(Parent, id , "The value is", Me, "MyVar", "Here is
the comment to MyVar")
"The value is": This is displayed in the left column of a grid
Me: The class where the Property is a memher of
"MyVar": The property MyVar (Has to be written as a string, that
prevents unfortunately this parameter that it can be renamed automaticly by
IDE)
The value of the property is shown in the right col of the grid. I'm
wondering why a parameter is given such a way, but it is and I should have a
solution which "extract" the NAME of the variable to a string. I hope I've
explained it clear enough. Beside I'm not looking for the value of the
property.
I have still problems to use the suggested Type.GetField(..), Where I have
to write MyVar in this method? Can you give me the whole syntax, ideal with
the example MyVar? When I rename MyVar in the IDE the rename should be
appear in this expressions too.
Thanks Peter
"Armin Zingler" <az*******@freenet.deschrieb im Newsbeitrag
news:O2**************@TK2MSFTNGP02.phx.gbl...
"Peter Gast" <pe********@tiscali.deschrieb
>Hi,
I need as a parameter for a control the names of my properties as a
string. How can I get the name of the property as a string during
runtime
Example:
Private _MyVar As Double
Public ReadOnly Property MyVar As Double
Get
Return _MyVar
End Get
End Property
....
MsgBox ( ???? MyVar.GetType ?????)
....
The result should be "MyVar", I've got a tip to us
Type.GetField(...), but this expressions doesn't work.
Why do you need the name of a property? This does not make sense at all:
If
you need the name of a property, you must know the name of which property
to
get the name. That's...
I you want to get the name of all properties of a class, use
Type.GetProperties.
Do you want to get the /type/ of the property?
Maybe you are looking for the /value/ of an object's property while late
binding the property's name? Then Type.GetField should work.
"/Advanced/ Development Technologies":
http://msdn2.microsoft.com/en-us/library/cxz4wk15.aspx
Armin