By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,659 Members | 911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,659 IT Pros & Developers. It's quick & easy.

catch changing of the Control.Name Property

P: n/a
i'd like to monitor changes of the "Control.Name" porperty during
designtime.
if the user changes the name in designer my event musst fire.

i have created a own button control. with an event NameChange.

during runtime it works fine. if the name of the control has changed the
event is fireing.

(for example: designtime name of the button is btnOk, on a second button
i changed the name
during runtime with btnOk.Name = "btnOk2", -> event is ok)

but now i need the same event during desingtime, cause i need to write
the changed
name property into a txt file.

(renaming btnOk to btnOk2 in designer, -> need the event at this place)

how can i bind my event during designtime too?

regards

Daniel
Nov 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Weinand,

I think that the only way you are going to be able to do this is to be
able to write an add in to catch this. At design time, the Name property of
the control is not set, so you would have to hook into the designer to
determine when this happens.

I am curious, what is this needed for?

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Weinand Daniel" <sh******@gmx.de> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
i'd like to monitor changes of the "Control.Name" porperty during
designtime.
if the user changes the name in designer my event musst fire.

i have created a own button control. with an event NameChange.

during runtime it works fine. if the name of the control has changed the
event is fireing.

(for example: designtime name of the button is btnOk, on a second button i
changed the name
during runtime with btnOk.Name = "btnOk2", -> event is ok)

but now i need the same event during desingtime, cause i need to write the
changed
name property into a txt file.

(renaming btnOk to btnOk2 in designer, -> need the event at this place)

how can i bind my event during designtime too?

regards

Daniel

Nov 16 '05 #2

P: n/a
hello,

i need this feature for a localization project.
if a own button (or other control) has schanged its name, i will wirte
the name in a txt file. i need this feature for a localization project
with different
resource files. global and local files. if a control is not defined in
global resources,
the name should be written like this in the local.txt:
btnOk.Text = whatever

if the name changes during designtime i will do thefollowing:

replace "btnOk.Text = whatever" with "newName.Text = whatever"

so far so good...... hope you'll understand a bit what im trying.

if a form is localizable in VS, the names and other important things are
changed
automatically by VS if values are changed in designer.
i'd like to clone this feature for my txt file. but only for 2 or 3
attributes.

any ideas or suggestions how to hook into the designer to determine when
the property is set?

cheers

Nicholas Paldino [.NET/C# MVP] wrote:
Weinand,

I think that the only way you are going to be able to do this is to be
able to write an add in to catch this. At design time, the Name property of
the control is not set, so you would have to hook into the designer to
determine when this happens.

I am curious, what is this needed for?

Hope this helps.

Nov 16 '05 #3

P: n/a
Hi Weinand,

If you created your own control what we need to do is to create your own
designer for that control and use a shadow property for the Name. this way
you can catch all the Name changes. Designers use shadow properties that's
why some of the events are not fired during design time.

More info about designers you can find in the following links:
http://www.developerfusion.com/show/4411/2/
http://windowsforms.net/articles/shapedesigner.aspx
http://www.msdn.microsoft.com/librar...sgnrdotnet.asp

--
HTH
Stoitcho Goutsev (100) [C# MVP]
"Weinand Daniel" <sh******@gmx.de> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
i'd like to monitor changes of the "Control.Name" porperty during
designtime.
if the user changes the name in designer my event musst fire.

i have created a own button control. with an event NameChange.

during runtime it works fine. if the name of the control has changed the
event is fireing.

(for example: designtime name of the button is btnOk, on a second button i
changed the name
during runtime with btnOk.Name = "btnOk2", -> event is ok)

but now i need the same event during desingtime, cause i need to write the
changed
name property into a txt file.

(renaming btnOk to btnOk2 in designer, -> need the event at this place)

how can i bind my event during designtime too?

regards

Daniel

Nov 16 '05 #4

P: n/a
hi,
thank you so much for these informations!
hope to get it running with these informations.

thx a lot.

greetz

Stoitcho Goutsev (100) [C# MVP] wrote:
Hi Weinand,

If you created your own control what we need to do is to create your own
designer for that control and use a shadow property for the Name. this way
you can catch all the Name changes. Designers use shadow properties that's
why some of the events are not fired during design time.

More info about designers you can find in the following links:
http://www.developerfusion.com/show/4411/2/
http://windowsforms.net/articles/shapedesigner.aspx
http://www.msdn.microsoft.com/librar...sgnrdotnet.asp

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.