Re: Codings not changed when a control is renamed in VS2005.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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?



.



Relevant Pages

  • Re: Codings not changed when a control is renamed in VS2005.
    ... button so the Private Sub Button1_Click coding is created automatically. ... I added some codings to the subroutine. ... subroutine will still run or not when I click on the YesButton control. ... I want to rename the control. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Codings not changed when a control is renamed in VS2005.
    ... So, when I delete a control, VS just removes the handle of the control from ... the subroutine and leave the subroutine there. ... button so the Private Sub Button1_Click coding is created automatically. ... I want to rename the control. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Codings not changed when a control is renamed in VS2005.
    ... So, when I delete a control, VS just removes the handle of the control from ... the subroutine and leave the subroutine there. ... > button so the Private Sub Button1_Click coding is created> automatically. ... I want to rename the control. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Is there any way to start (and later quit) an EXE file.
    ... the QuitApp subroutine so that it will terminate any process named "VNC.exe" ... Is there also a way to avoid the first macro trying to load the EXE a ... regain complete control of XP and lose barcode scanner control. ... You can use the Shell function to launch an executable file but you ...
    (microsoft.public.excel.misc)
  • Help needed with XML::Smart
    ... that can work with any XML file with a similar format. ... no problem coding addition or deletion for the array variables. ... } #end subroutine readCfgFile ...
    (comp.lang.perl.modules)