name for button does not change in click event
I have 2 buttons name btnHonda and btnToyota, but the click event clicks show:privatevoid button1_Click(object sender,EventArgs e)
{
}
privatevoid btnToyota_Click(object sender,EventArgs e)
{
}
button1_Click should be btnHonda_click .....is this a bug with Visual C# 2005?
Hi,
This haven't happened to me before. Could you reproduce it? Provide us some steps? Does the code in the ambiguos name executes when you press the button?
cheers,
Paul June A. Domag
Hi,
Ok, I reproduced it. Well, I think this would be considered as by design. On default, the name of the object would be used on an event. But also, you have the capability of naming you own event (
In the properties toolbox, click on the lightning button), I guess this is the reason why the IDE doesn't automatically change the event name into the new object name.
Also, multiple controls could be sharing a single event procedure. Button1 and Button2 could be executing clickMe() event and If I rename Button1 should the event also be renamed?
BTW, if you want to change your event's name, you could do it manually in the properties toolbox...
cheers,
Paul June A. Domag