Re: Codings not changed when a control is renamed in VS2005.
- From: Tim Patrick <invalid@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Jun 2007 21:33:22 +0000 (UTC)
That's true, because in .NET, subroutine names for event are not considered important. You no longer have to name your events "Button1_Click". Instead you can name them "BlueSuedeShoes" and it will work just fine.
Private Sub BlueSuedeShoes(...) Handles Button1.Click
End Sub
The Handles clause is what is important. And since the Handles clause can be followed by multiple comma-separated event names (such as "Button1.Click, Button2.Click, Button3.Click"), the routine name will not always match an event signature anyway. Visual Studio doesn't want to mess with whatever meaningful names you gave to the event handler, so it leaves it alone.
-----
Tim Patrick - www.timaki.com
Start-to-Finish Visual Basic 2005
Hi Patrick,
It is already true. It does change any reference to the object.
However, it does not change the subroutine name. For example, I have
added a button to a form. The button is default with the name
Button1. I clicked the button so the Private Sub Button1_Click coding
is created automatically. Then I added some codings to the subroutine.
When I rename the button from Button1 to YesButton, I want the
subroutine Button1_Click renamed to YesButton_Click. Actually, I have
not tried yet whether that Button1_Click subroutine will still run or
not when I click on the YesButton control. If another person looks at
the coding, how can he/she knows Button1_Click is for the YesButton?
Peter
"Tim Patrick" wrote:
In Visual Studio, open the options form through Tools / Options. On
the left side, select the Windows Forms Designer / General tree
branch. On the right side, make sure that "EnableRefactoringOnRename"
is set to True. It will slow down your IDE when renaming, but it
should update all references to a control name.
-----
Tim Patrick - www.timaki.com
Start-to-Finish Visual Basic 2005
I'm new to Visual Studio 2005. I'm creating a windows application
using Visual Basic. After I added a control to a form and added
some codings to the control, I want to rename the control. However,
I notice that after I rename the control, the codings inside it are
still using the old name. Is there a setting that I can set to
replace the old name with the new name automatically (for the entire
form or all coding within the same project) when I rename a control?
Also, after I deleted a control from a form, I can still see the
coding of the deleted control. Is there a setting to remove those
codings automatically when the control is deleted?
.
- Prev by Date: Re: Codings not changed when a control is renamed in VS2005.
- Next by Date: Re: Reliable way to change the cursor
- Previous by thread: Re: Codings not changed when a control is renamed in VS2005.
- Next by thread: generate 6 digit unique id
- Index(es):
Relevant Pages
|