473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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

Nov 17 '05 #1
3 1151
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

Nov 17 '05 #2
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,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"M Shafaat" <M Sh*****@discussions.microsoft.com> wrote in message
news:5E**********************************@microsof t.com...
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

Nov 17 '05 #3
Well, sorry I expressed badly what I want to do.
By "name", I mean "identifier".

Regards
M Shafaat

"Ignacio Machin ( .NET/ C# MVP )" wrote:
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,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"M Shafaat" <M Sh*****@discussions.microsoft.com> wrote in message
news:5E**********************************@microsof t.com...
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


Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mark Fisher | last post by:
I have a Java desktop GUI application that the user can run multiple times. In order to keep one instance of the application distinct from another, I'd like to put the instance number of the...
18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
3
by: mikeorb | last post by:
Is there a way to determine the object that a property is in? For example: function MyClass() { ... } MyClass.prototype.myFunc = function() { ... } var obj = new MyClass(); var sameobj =...
10
by: Lance | last post by:
Is there any way to determine the full name of an object at runtime? For example, if I have the following Namespace MyNameSpac Public Class MyClas Protected MyObject As Object 'This could be...
7
by: Doru Roman | last post by:
Hi, What is the fastest way to evaluate manually the result in this case: int a, b, c; a = 255; b = 122; c = a & b; The only way I know is transforming each number into the binary value...
5
by: MLH | last post by:
Suppose MyName, a string variable equals "frmEnterClients". How can I determine ... 1) if frmEnterClients exists as an object in the database? 2) what type of object is it (tbl, qry, frm, rpt,...
3
by: Developer in California | last post by:
I am working on developing a generic Web framework using Master Pages in ASP.NET 2.0. What I have done is created a PageRenderer class which has a public method which will retrieve the path of the...
8
by: Ole | last post by:
If I define a class and create a instant of it like e.g.: UserClass instantName = new UserClass(); how do I then determine the defined name "instantName" in the UserClass e.g. in a method (or...
13
by: softwaredoug | last post by:
I can't see to easily find this on google or in a newsgroup Is there a standard function/macro/whatever you can call and determine the distance in a C program how deep one is in the C call stack...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.