H
Harlan Messinger
When I create a custom control, within its defining code I have access
to the eventual name of the actual control instantiated from it via
this.Name. This allows me, for example, to print out an error message
from within one of the control's properties that identifies the
offending control by the name the user assigned to it:
if (dataName == null || dataName.Equals(""))
throw new InvalidOperationException("Property \"DataName\" not set for
PersistingTextBox control \"" + this.Name + "\".");
The client app would return "persistentTextBox1" for this.Name if the
developer left the default name for the first PersistentTextBox object
on the form.
However, a Component doesn't seem to have the same feature. It has no
Name property, or anything else that I can find that would return the
name of the instantiated component. Is there some way to do this?
to the eventual name of the actual control instantiated from it via
this.Name. This allows me, for example, to print out an error message
from within one of the control's properties that identifies the
offending control by the name the user assigned to it:
if (dataName == null || dataName.Equals(""))
throw new InvalidOperationException("Property \"DataName\" not set for
PersistingTextBox control \"" + this.Name + "\".");
The client app would return "persistentTextBox1" for this.Name if the
developer left the default name for the first PersistentTextBox object
on the form.
However, a Component doesn't seem to have the same feature. It has no
Name property, or anything else that I can find that would return the
name of the instantiated component. Is there some way to do this?