Changing control name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I'm a Vb6 developer just getting into .Net & I like it!
But...

How do I change the name of a control, say, a button, once code has been
written to it. Even if I delete the old event, whenever I click on the newly
named control, it brings me to the old controls click event. i found that if
i manually change the event name to the new name, it works. Is this the best
or only way of changing a controls name, by manually changing the event name
as well?

thanks for your input
Ant
 
Ant.

Assuming that you use the IDE and change your name in the designer part by
right clicking on the control, than everything should go automaticly. If you
change things in the code, than you have to do everything by hand.

What not does change even using the designer is

Sub Button1_Click (bla bla) handles me.MyEndButton.

That Button1_Click name does mostly nothing and when you need to use that,
than you have to do that with hand. (You would not be glad if it was
changing and you was calling the procedure from another sub).

I hope this helps,

Cor
 
Hi Cor,
Thanks for your reply. You are right. When I change the name with the
properties window, the code in the original event still fires ok. If I decide
to rename the event to correspond to the controls new name however, I get a
build error. Do I need to do something additionally when I rename the event
to match the control?

Thanks for your help
Ant
 
Ant,
Thanks for your reply. You are right. When I change the name with the
properties window, the code in the original event still fires ok. If I
decide
to rename the event to correspond to the controls new name however, I get
a
build error. Do I need to do something additionally when I rename the
event
to match the control?

No forgive me how I write it, you should do than something stupid or have
used that name that you changed already somewhere else. As I wrote in my
previous message.

Cor
 
Thank you
Ant

Cor Ligthert said:
Ant,


No forgive me how I write it, you should do than something stupid or have
used that name that you changed already somewhere else. As I wrote in my
previous message.

Cor
 
Back
Top