How can I determine the name of a new object or variable at run-ti

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!
I want to write C# code by which I can determine the name of an object
and/or variable at run-time.

VS design windows does it when you drag a control onto your form. It uses
the name of the control's type and adds a number to it and creates a name for
the object, like "button2".

Regards
M Shafaat
 
Do you mean the name of the type of the object? objects don't have names

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi!
I want to write C# code by which I can determine the name of an object
and/or variable at run-time.

VS design windows does it when you drag a control onto your form. It uses
the name of the control's type and adds a number to it and creates a name for
the object, like "button2".

Regards
M Shafaat
 
Hi,

If the object is derived from Control ( like textbox, combobox, etc ) you
can use Control.Name ,

what is what you want to do anyway?

cheers,
 
Well, sorry I expressed badly what I want to do.
By "name", I mean "identifier".

Regards
M Shafaat
 
Back
Top