473,623 Members | 3,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to rename "button1" in Form source code to "but_change_set " ?

When I create in Designer a new button on my Form it is automatically
named e.g. "button1".

When I doubleclick on it I am directed to the Form.cs where the following
procedure is automatcially generated:

private void button1_Click(O bject sender, EventArgs e) {
}

To improve readability I want to rename now "button1" to "but_change_set ".
Back in Desinger pane I changed the name in the properties pane accordingly.

When I doubleclick now on the same button again I am directed to the source
again. But much to my surprise neither a new procudure

private void but_change_set_ Click(Object sender, EventArgs e) {
}

is created nor the old existing procedure is renamed.

Hmmm, How can I achieve a renaming in the source code as well ?

Ole

May 17 '07 #1
2 2370

"Ole Mercano" <om***@yahoo.co .ukwrote in message
news:46******** **************@ newsspool2.arco r-online.net...
When I create in Designer a new button on my Form it is automatically
named e.g. "button1".

When I doubleclick on it I am directed to the Form.cs where the following
procedure is automatcially generated:

private void button1_Click(O bject sender, EventArgs e) {
}

To improve readability I want to rename now "button1" to "but_change_set ".
Back in Desinger pane I changed the name in the properties pane
accordingly.

When I doubleclick now on the same button again I am directed to the
source
again. But much to my surprise neither a new procudure

private void but_change_set_ Click(Object sender, EventArgs e) {
}

is created nor the old existing procedure is renamed.

Hmmm, How can I achieve a renaming in the source code as well ?

Ole
If this is VS 2005 and the naming didn't happen, which it did for me when I
double clicked the button in form design, then go to InitializeCompo nent on
the FormName.cs,whi ch is located in the drop down box at top right.

In the InitializeCompo nent(), you'll see the Button-Click Event-Handler
which is pointing to the Sub for the event, rename the Sub there and rename
the Sub that it's pointing to, for the event.

If it's VS 2003, then it's the same thing find InitializeCompo nent() in code
and change the Event-Handler event name that it points too.
May 17 '07 #2
On Thu, 17 May 2007 08:24:58 -0700, Ole Mercano <om***@yahoo.co .ukwrote:
[...]
When I doubleclick now on the same button again I am directed to the
source again. But much to my surprise neither a new procudure

private void but_change_set_ Click(Object sender, EventArgs e) {
}

is created nor the old existing procedure is renamed.

Hmmm, How can I achieve a renaming in the source code as well ?
When you change the name of the control, all that you are doing is
changing the field name in the form. So the only automatic renaming that
occurs is anywhere that field name is used. If you want the name of the
method to change, you have to do that manually.

If all you want is a brand new method to be created, just delete the old
reference in the event in the designer and double-click the event again.

As for why this would be: consider the situation where you have a method
that doesn't follow the designer's naming strategy. For example, you
wanted your own custom name, or you're sharing a single event handler
among many controls. Obviously automatic renaming wouldn't work in those
cases, and so the designer is just making sure its behavior is consistent.

Pete
May 17 '07 #3

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

Similar topics

2
4157
by: enrio | last post by:
I need to process the source code associated with the forms outside access, and import the changes back to Access. I find that I can export the source code of a form, but when I subsequently import it, even with no change, I get a message saying the module name is illegal. If the form is named Form_NewParticipant, the export file gets named Form_NewParticipant.cls, and when I reimport it, the error message quotes the name...
2
2240
by: Maellic | last post by:
Hi, I'm currently updating a website written with ASP.NET. The original programmer is overseas, there is no documentation, and files are all over the place. Here is a code snippet from one of the .vb file used by the application (the entire code of the file is at the end of the post): If EmissionsWebBLL.Security.ValidateLogin(txtUserName.Text,
2
6097
by: Jason | last post by:
Why is it that whenever I rename a form from Form1 to something else it fails during the build. I get an error - Sub Main not found...... What is the problem? If I rename the form back to Form1, it works fine. is there a fix?
3
1998
by: forum | last post by:
Hi, many mistakes in programming arise when one changes the code and forgets to adjustment somewhere where it is used. Is there a program that can extract all place in the source code where a variable is accessed or a function called? For example in the simplest case I want to change the name of a function everywhere in the source... Anton
2
2707
by: HeroinNO.4 | last post by:
Hello everyone! Now the latest version of free count down timer source code is available in http://www.fillweb.com/countdown.htm, you can open it in IE and View->Source to see the latest version source code, also you may copy the code below and save in a ".htm" file, and run it in browser, a cool count down timer will show you ! <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type"...
7
3285
by: HeroinNO.4 | last post by:
Hello guys, free count down timer source code has updated to 06/11/27, you can copy the code below and save in a ".htm" file and run it in a browser support javascript 1.1 or later, or you can open http:\\www.fillweb.com\countdown.htm, if you are using IE, you may View->Source to see the latest version of source code ! <html> <head> <meta http-equiv="Content-Language" content="en-us">
3
5903
by: Mac Campbell | last post by:
For some unknown reason my mdb seemed to drop a module I had named "Utilities". I tried to copy the module back in from a backup copy and got the error message "<<MyProject>> is currently unable to rename the form, report, or module to 'Utilities' ... Close the database, reopen it, and try the rename operation again." This didn't work. It seemed that other modules could still be renamed normally, but this one - "Utilities" - could not. I could...
2
5071
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer must be embedded somewhere in the source code, and I would like to know if anyone knows where to find the correct answer. I would greatly appreciate it!! Thanks!! <!--put the preloads file here as it must load before the website class...
2
1473
by: zandiT | last post by:
Hey, FRMLOGIN CODE Private Sub Form_Load() If userdeptid = 1 then me.Controlname.visible = false end sub i managed to get the swichboard to open from a succesful login but now i want some controls to be hiddien depending on who logged in. how do i get to the swtich board controls from code in the login form because line 3 is giving me controls for the current form, login form
0
8221
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8662
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8603
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8463
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7134
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6104
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2593
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1468
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.