473,324 Members | 2,166 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,324 software developers and data experts.

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(Object 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 2347

"Ole Mercano" <om***@yahoo.co.ukwrote in message
news:46**********************@newsspool2.arcor-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(Object 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 InitializeComponent on
the FormName.cs,which is located in the drop down box at top right.

In the InitializeComponent(), 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 InitializeComponent() 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
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...
2
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...
2
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...
3
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...
2
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...
7
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...
3
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...
2
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...
2
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.