473,387 Members | 1,745 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,387 software developers and data experts.

catch changing of the Control.Name Property

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
4 2968
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ColinWard | last post by:
Hi. I have a form which has as its recordsource an SQL string. The SQL String is as follows: SELECT * from CONTACTS where false. this ensures that there is no data loaded in the form when the...
5
by: David | last post by:
Hi I seem to be getting nowhere with this. I am opening a form which will be used to input Notes into different fields in a table. My problem is changing the unbound field name to the field name...
4
by: Tony W | last post by:
Hi, I am trying to write a simple application to retrieve data from the Windows registry and insert it into textboxs on a windows form. So far I have one namespace containing two classess. ...
6
by: AMP | last post by:
Hello, I have an mdi program with a child form ("A") and another child ("B"). I want to change the text of a label on A by changing an item from a combobox on B. I can code the...
3
by: dcassar | last post by:
I am working on a complex server control that dynamically creates an HtmlInputHidden control that stores its value. As far as the postback process is concerned, this hidden input acts as the...
8
by: Steve | last post by:
Hi All Is there a way to change the colour of a Groupbox border in VB.net 2005 I want to change it to white Can it be done in the onpaint event? Regards Steve
1
by: antani | last post by:
I have a groupbox in my application that contains many control as NumericUpDown and CheckBox. I would like capture event on groupbox control as changing NumericUpDown value and checkbox change ....
8
by: mike_solomon | last post by:
I have a button <input type="submit" name="Delete" value="Delete"> This code can not be changed I want to use Javascript to change the type I tried:
2
by: pdickson | last post by:
Hi - I am using custom textboxes and I need to be able to set the Text on txb1 based on the Text of txb2. I have simplied my code to the following: Public Class customtextbox Inherits...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.