Visual Studio bug ?

  • Thread starter Thread starter C# newbie
  • Start date Start date
C

C# newbie

Hi Group,

Am I doing wrong or something weird with VS.NET ?
when I change the name of a control (let's say a "Button") using properties
panel then the name of control in method stays unchanged! for instance I had
a Button with "Button5" name after I changed the name of it to "Save" as you
see it below it's still what it used to be!
Everytime I have to change the class members manually.

Any comment on this ?
Thanks

private void button5_Click(object sender, System.EventArgs e)

{


}
 
Hello,

This is actually an expected behaviour from VS.NET since you can name
your callback method to whatever you want, and then VS.NET should not
rename it. The things is that you use a built in function in VS.NET to
generate
the skeleton code for your callback and then VS.NET used the control name
as a part of the callback name.

I do agree that it would perhaps be a nice feature that if you used a VS.NET
generated callback name then VS.NET should update it if the control name,
changed but it is definitly not a bug.

The imporant thing is that VS.NET updates the code for the control in the
InitializeComponent() method. In your case it would have changed

this.button5.Click +=
new System.EventHandler(button5_Click);

into

this.Save.Click +=
new System.EventHandler(button5_Click);

Hope this helps,

//Andreas
 
Yes, thanks for your reponse.



Andreas Håkansson said:
Hello,

This is actually an expected behaviour from VS.NET since you can name
your callback method to whatever you want, and then VS.NET should not
rename it. The things is that you use a built in function in VS.NET to
generate
the skeleton code for your callback and then VS.NET used the control name
as a part of the callback name.

I do agree that it would perhaps be a nice feature that if you used a VS.NET
generated callback name then VS.NET should update it if the control name,
changed but it is definitly not a bug.

The imporant thing is that VS.NET updates the code for the control in the
InitializeComponent() method. In your case it would have changed

this.button5.Click +=
new System.EventHandler(button5_Click);

into

this.Save.Click +=
new System.EventHandler(button5_Click);

Hope this helps,

//Andreas
 
Back
Top