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? 7 2233
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?
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?
On Jun 28, 4:10 pm, Peter <P...@discussions.microsoft.comwrote:
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?
Because after the method declaration, you should see a Handles clause
which tells which button the method handles.
It doesn't really make sense for the method to be renamed anyway,
because the same method might be used for several different buttons.
Consider this:
Suppose you had 3 buttons on the form: Button1, Button2, and Button3
Now suppose you had one click method for all three buttons:
'This method handles the click event for all 3 buttons.
Private Sub ButtonClick(...) Handles Button1.Click, Button2.Click,
Button3.Click
End Sub
If you then renamed Button2 to YesButton, how would the IDE know what
to rename the click method to? And if it somehow renamed the method
to 'Button2Click', then it would not make sense for Buttons 1 and 3
which are serviced by the same sub.
The name of the Click sub is irrelavant to the event.
Chris
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?
Hi Chris,
I understand the scenario you're talking about. I didn't notice the Handle
part. I guess the Handle part is actually indicating which control
events/methods are binded to the subroutine.
So, when I delete a control, VS just removes the handle of the control from
the subroutine and leave the subroutine there. If there is the case and I
have many controls on a from and then later on I delete many of them, the
form will contain many routines which have no handle part. Is there a way to
delete those automatically?
Peter
Peter
"Chris Dunaway" wrote:
On Jun 28, 4:10 pm, Peter <P...@discussions.microsoft.comwrote:
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?
Because after the method declaration, you should see a Handles clause
which tells which button the method handles.
It doesn't really make sense for the method to be renamed anyway,
because the same method might be used for several different buttons.
Consider this:
Suppose you had 3 buttons on the form: Button1, Button2, and Button3
Now suppose you had one click method for all three buttons:
'This method handles the click event for all 3 buttons.
Private Sub ButtonClick(...) Handles Button1.Click, Button2.Click,
Button3.Click
End Sub
If you then renamed Button2 to YesButton, how would the IDE know what
to rename the click method to? And if it somehow renamed the method
to 'Button2Click', then it would not make sense for Buttons 1 and 3
which are serviced by the same sub.
The name of the Click sub is irrelavant to the event.
Chris
"Peter" <Pe***@discussions.microsoft.comwrote in message
news:5B**********************************@microsof t.com...
Hi Chris,
I understand the scenario you're talking about. I didn't notice the
Handle
part. I guess the Handle part is actually indicating which control
events/methods are binded to the subroutine.
So, when I delete a control, VS just removes the handle of the control
from
the subroutine and leave the subroutine there. If there is the case and
I
have many controls on a from and then later on I delete many of them, the
form will contain many routines which have no handle part. Is there a way
to
delete those automatically?
Peter
Peter
"Chris Dunaway" wrote:
>On Jun 28, 4:10 pm, Peter <P...@discussions.microsoft.comwrote:
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?
Because after the method declaration, you should see a Handles clause which tells which button the method handles.
It doesn't really make sense for the method to be renamed anyway, because the same method might be used for several different buttons.
Consider this:
Suppose you had 3 buttons on the form: Button1, Button2, and Button3
Now suppose you had one click method for all three buttons:
'This method handles the click event for all 3 buttons. Private Sub ButtonClick(...) Handles Button1.Click, Button2.Click, Button3.Click End Sub
If you then renamed Button2 to YesButton, how would the IDE know what to rename the click method to? And if it somehow renamed the method to 'Button2Click', then it would not make sense for Buttons 1 and 3 which are serviced by the same sub.
The name of the Click sub is irrelavant to the event.
Chris
Remember that you can use the same sub to handle events from many controls.
Removing the code can not be done since the IDE has no idea what you are
trying to accomplish when you delete a control. There are situations where
you can delete a button from one place on the form and then add it somewhere
else. If you were to have the handler code automatically deleted I would
think that would be a worse situation.
LS
Hi Lloyd,
I agree with you. May be the right-click menu should include a special
delete function to delete both control and related codings?
Peter
"Lloyd Sheen" wrote:
>
"Peter" <Pe***@discussions.microsoft.comwrote in message
news:5B**********************************@microsof t.com...
Hi Chris,
I understand the scenario you're talking about. I didn't notice the
Handle
part. I guess the Handle part is actually indicating which control
events/methods are binded to the subroutine.
So, when I delete a control, VS just removes the handle of the control
from
the subroutine and leave the subroutine there. If there is the case and
I
have many controls on a from and then later on I delete many of them, the
form will contain many routines which have no handle part. Is there a way
to
delete those automatically?
Peter
Peter
"Chris Dunaway" wrote:
On Jun 28, 4:10 pm, Peter <P...@discussions.microsoft.comwrote:
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?
Because after the method declaration, you should see a Handles clause
which tells which button the method handles.
It doesn't really make sense for the method to be renamed anyway,
because the same method might be used for several different buttons.
Consider this:
Suppose you had 3 buttons on the form: Button1, Button2, and Button3
Now suppose you had one click method for all three buttons:
'This method handles the click event for all 3 buttons.
Private Sub ButtonClick(...) Handles Button1.Click, Button2.Click,
Button3.Click
End Sub
If you then renamed Button2 to YesButton, how would the IDE know what
to rename the click method to? And if it somehow renamed the method
to 'Button2Click', then it would not make sense for Buttons 1 and 3
which are serviced by the same sub.
The name of the Click sub is irrelavant to the event.
Chris
Remember that you can use the same sub to handle events from many controls.
Removing the code can not be done since the IDE has no idea what you are
trying to accomplish when you delete a control. There are situations where
you can delete a button from one place on the form and then add it somewhere
else. If you were to have the handler code automatically deleted I would
think that would be a worse situation.
LS This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: NotGiven |
last post by:
I read several web sites and O'Reilly's book on MySQL about securing the
system tables.
I removed several users and, as advised inthe book and web sites, changed
the user "root" to another name...
|
by: Pattabi |
last post by:
Hi guys!!!!!!!!!
Can anyone help me out in this. I have .ascx file with one
textbox control in it. I am using it in my .aspx file. What happens is
i am giving the id of textbox control in ascx as...
|
by: Jaime Stuardo |
last post by:
Hi all....
I am programming in ASP.NET 2.0 and VS.NET 2005 Beta 2.
I have a MasterPage that provides basic look & feel for my pages.
The main form present in the master page has this...
|
by: Mark Olbert |
last post by:
I'm starting to play around with VS2005 and ASP.NET 2 and have some questions.
The typical pattern for a data-driven aspx page in v1.1 was data connection -> data adapter -> dataset -> bound...
|
by: David |
last post by:
Using VS2005 and .Net 2.0
I want to be able to keep the user from moving to another web page if they
have selected the "Edit" link button on a FormView (or any view for that
matter), have changed...
| |
by: tony |
last post by:
Hello!
I just want to find out how the system find the name to set on a assembly
User control dll.
I have done this.
1. Create a user control
- Here the namespace was set by the system to...
|
by: Andy DeMaurice |
last post by:
Something has changed from C# 1.0 to 2.0 regarding interface
re-implementation. See my sample code below; when compiled and run under VS
2003, you get:
Control.Paint
Control.IControl.Paint
...
|
by: Dave Anson |
last post by:
The DataSet designer in Visual Studio 2005 is still pointing to the
old database.
I have done this before and it worked without a hitch. The problem is
that I have moved the database and...
|
by: =?Utf-8?B?UmljaA==?= |
last post by:
On my development machine where I have Visual Studio 2005 loaded, I have an
app that uses the Report control. I can view data in report format with the
Report control -- the data renders OK in the...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |